晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
Server : Apache System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64 User : rainic ( 1014) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /proc/thread-self/root/home/akaindir/public_html/crm/vtlib/Vtiger/ |
Upload File : |
<?php
/*+**********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
************************************************************************************/
require_once 'includes/runtime/Cache.php';
include_once('vtlib/Vtiger/ModuleBasic.php');
/**
* Provides API to work with vtiger CRM Modules
* @package vtlib
*/
class Vtiger_Module extends Vtiger_ModuleBasic {
/**
* Function to get the Module/Tab id
* @return <Number>
*/
public function getId() {
return $this->id;
}
/**
* Get unique id for related list
* @access private
*/
function __getRelatedListUniqueId() {
global $adb;
return $adb->getUniqueID('vtiger_relatedlists');
}
/**
* Get related list sequence to use
* @access private
*/
function __getNextRelatedListSequence() {
global $adb;
$max_sequence = 0;
$result = $adb->pquery("SELECT max(sequence) as maxsequence FROM vtiger_relatedlists WHERE tabid=?", Array($this->id));
if($adb->num_rows($result)) $max_sequence = $adb->query_result($result, 0, 'maxsequence');
return ++$max_sequence;
}
/**
* Set related list information between other module
* @param Vtiger_Module Instance of target module with which relation should be setup
* @param String Label to display in related list (default is target module name)
* @param Array List of action button to show ('ADD', 'SELECT')
* @param String Callback function name of this module to use as handler
*
* @internal Creates table vtiger_crmentityrel if it does not exists
*/
function setRelatedList($moduleInstance, $label = '', $actions = false, $function_name = 'get_related_list', $fieldId = null) {
global $adb;
if(empty($moduleInstance)) return;
if(!Vtiger_Utils::CheckTable('vtiger_crmentityrel')) {
Vtiger_Utils::CreateTable(
'vtiger_crmentityrel',
'(crmid INT NOT NULL, module VARCHAR(100) NOT NULL, relcrmid INT NOT NULL, relmodule VARCHAR(100) NOT NULL)',
true
);
}
$relation_id = $this->__getRelatedListUniqueId();
$sequence = $this->__getNextRelatedListSequence();
$presence = 0; // 0 - Enabled, 1 - Disabled
if(empty($label)) $label = $moduleInstance->name;
// Allow ADD action of other module records (default)
if($actions === false) $actions = Array('ADD');
$useactions_text = $actions;
if(is_array($actions)) $useactions_text = implode(',', $actions);
$useactions_text = strtoupper($useactions_text);
// Add column to vtiger_relatedlists to save extended actions
Vtiger_Utils::AddColumn('vtiger_relatedlists', 'actions', 'VARCHAR(50)');
$adb->pquery("INSERT INTO vtiger_relatedlists(relation_id,tabid,related_tabid,name,sequence,label,presence,actions,relationfieldid) VALUES(?,?,?,?,?,?,?,?,?)",
Array($relation_id,$this->id,$moduleInstance->id,$function_name,$sequence,$label,$presence,$useactions_text,$fieldId));
self::log("Setting relation with $moduleInstance->name [$useactions_text] ... DONE");
}
/**
* Unset related list information that exists with other module
* @param Vtiger_Module Instance of target module with which relation should be setup
* @param String Label to display in related list (default is target module name)
* @param String Callback function name of this module to use as handler
*/
function unsetRelatedList($moduleInstance, $label='', $function_name='get_related_list') {
global $adb;
if(empty($moduleInstance)) return;
if(empty($label)) $label = $moduleInstance->name;
$adb->pquery("DELETE FROM vtiger_relatedlists WHERE tabid=? AND related_tabid=? AND name=? AND label=?",
Array($this->id, $moduleInstance->id, $function_name, $label));
self::log("Unsetting relation with $moduleInstance->name ... DONE");
}
function unsetRelatedListForField($fieldId) {
$db = PearDatabase::getInstance();
$db->pquery("DELETE FROM vtiger_relatedlists WHERE relationfieldid=?", array($fieldId));
}
/**
* Add custom link for a module page
* @param String Type can be like 'DETAILVIEW', 'LISTVIEW' etc..
* @param String Label to use for display
* @param String HREF value to use for generated link
* @param String Path to the image file (relative or absolute)
* @param Integer Sequence of appearance
*
* NOTE: $url can have variables like $MODULE (module for which link is associated),
* $RECORD (record on which link is dispalyed)
*/
function addLink($type, $label, $url, $iconpath='', $sequence=0, $handlerInfo=null) {
Vtiger_Link::addLink($this->id, $type, $label, $url, $iconpath, $sequence, $handlerInfo);
}
/**
* Delete custom link of a module
* @param String Type can be like 'DETAILVIEW', 'LISTVIEW' etc..
* @param String Display label to lookup
* @param String URL value to lookup
*/
function deleteLink($type, $label, $url=false) {
Vtiger_Link::deleteLink($this->id, $type, $label, $url);
}
/**
* Get all the custom links related to this module.
*/
function getLinks() {
return Vtiger_Link::getAll($this->id);
}
/**
* Get all the custom links related to this module for exporting.
*/
function getLinksForExport() {
return Vtiger_Link::getAllForExport($this->id);
}
/**
* Initialize webservice setup for this module instance.
*/
function initWebservice() {
Vtiger_Webservice::initialize($this);
}
/**
* De-Initialize webservice setup for this module instance.
*/
function deinitWebservice() {
Vtiger_Webservice::uninitialize($this);
}
/**
* Get instance by id or name
* @param mixed id or name of the module
*/
static function getInstance($value) {
$instance = Vtiger_Cache::get('module', $value);
if (!$instance && $instance !== NULL) {
$data = Vtiger_Functions::getModuleData($value);
if ($data) {
$instance = new self();
$instance->initialize($data);
Vtiger_Cache::set('module', $instance->id, $instance);
Vtiger_Cache::set('module', $instance->name, $instance);
} else {
Vtiger_Cache::set('module', $value, NULL);
}
}
return $instance ? $instance : false;
}
/**
* Get instance of the module class.
* @param String Module name
*/
static function getClassInstance($modulename) {
if($modulename == 'Calendar') $modulename = 'Activity';
$instance = false;
$filepath = "modules/$modulename/$modulename.php";
if(Vtiger_Utils::checkFileAccessForInclusion($filepath, false)) {
checkFileAccessForInclusion($filepath);
include_once($filepath);
if(class_exists($modulename)) {
$instance = new $modulename();
}
}
return $instance;
}
/**
* Fire the event for the module (if vtlib_handler is defined)
*/
static function fireEvent($modulename, $event_type) {
$instance = self::getClassInstance((string)$modulename);
if($instance) {
if(method_exists($instance, 'vtlib_handler')) {
self::log("Invoking vtlib_handler for $event_type ...START");
$instance->vtlib_handler((string)$modulename, (string)$event_type);
self::log("Invoking vtlib_handler for $event_type ...DONE");
}
}
}
}
?>