本文整理汇总了PHP中Vtiger_Utils类的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Utils类的具体用法?PHP Vtiger_Utils怎么用?PHP Vtiger_Utils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vtiger_Utils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __initExport
/**
* Initialize Export
* @access private
*/
function __initExport($layoutName)
{
// Security check to ensure file is withing the web folder.
Vtiger_Utils::checkFileAccessForInclusion("layouts/{$layoutName}/skins/vtiger/style.less");
$this->_export_modulexml_file = fopen($this->__getManifestFilePath(), 'w');
$this->__write("<?xml version='1.0'?>\n");
}
示例2: undo
function undo($moduleName, $userId)
{
$adb = PearDatabase::getInstance();
if (Vtiger_Utils::CheckTable($this->tableName)) {
$result = $adb->pquery('UPDATE vtiger_crmentity SET deleted=1 WHERE crmid IN
(SELECT crmid FROM ' . $this->tableName . ' WHERE userid = ? AND entitytype = ?)', array($userId, $moduleName));
return $adb->getAffectedRowCount($result);
}
}
示例3: delete
public function delete()
{
$adb = PearDatabase::getInstance();
parent::delete();
$fld_module = $this->getModuleName();
$id = $this->getId();
$uitype = $this->get('uitype');
$typeofdata = $this->get('typeofdata');
$fieldname = $this->getName();
$oldfieldlabel = $this->get('label');
$tablename = $this->get('table');
$columnname = $this->get('column');
$fieldtype = explode("~", $typeofdata);
$tabId = $this->getModuleId();
$focus = CRMEntity::getInstance($fld_module);
$deletecolumnname = $tablename . ":" . $columnname . ":" . $fieldname . ":" . $fld_module . "_" . str_replace(" ", "_", $oldfieldlabel) . ":" . $fieldtype[0];
$column_cvstdfilter = $tablename . ":" . $columnname . ":" . $fieldname . ":" . $fld_module . "_" . str_replace(" ", "_", $oldfieldlabel);
$select_columnname = $tablename . ":" . $columnname . ":" . $fld_module . "_" . str_replace(" ", "_", $oldfieldlabel) . ":" . $fieldname . ":" . $fieldtype[0];
$reportsummary_column = $tablename . ":" . $columnname . ":" . str_replace(" ", "_", $oldfieldlabel);
if ($tablename != 'vtiger_crmentity') {
$dbquery = 'alter table ' . $adb->quote($tablename, false) . ' drop column ' . $adb->quote($columnname, false);
$adb->pquery($dbquery, array());
}
//we have to remove the entries in customview and report related tables which have this field ($colName)
$adb->pquery('delete from vtiger_cvcolumnlist where columnname = ? ', array($deletecolumnname));
$adb->pquery('delete from vtiger_cvstdfilter where columnname = ?', array($column_cvstdfilter));
$adb->pquery('delete from vtiger_cvadvfilter where columnname = ?', array($deletecolumnname));
$adb->pquery('delete from vtiger_selectcolumn where columnname = ?', array($select_columnname));
$adb->pquery('delete from vtiger_relcriteria where columnname = ?', array($select_columnname));
$adb->pquery('delete from vtiger_reportsortcol where columnname = ?', array($select_columnname));
$adb->pquery('delete from vtiger_reportdatefilter where datecolumnname = ?', array($column_cvstdfilter));
$adb->pquery('delete from vtiger_reportsummary where columnname like ?', array('%' . $reportsummary_column . '%'));
//Deleting from convert lead mapping vtiger_table- Jaguar
if ($fld_module == 'Leads') {
$deletequery = 'delete from vtiger_convertleadmapping where leadfid=?';
$adb->pquery($deletequery, array($id));
} elseif ($fld_module == 'Accounts' || $fld_module == 'Contacts') {
$map_del_id = array('Accounts' => 'accountfid', 'Contacts' => 'contactfid');
$map_del_q = 'update vtiger_convertleadmapping set ' . $map_del_id[$fld_module] . '=0 where ' . $map_del_id[$fld_module] . '=?';
$adb->pquery($map_del_q, array($id));
}
//HANDLE HERE - we have to remove the table for other picklist type values which are text area and multiselect combo box
if ($this->getFieldDataType() == 'picklist' || $this->getFieldDataType() == 'multipicklist') {
$result = $adb->pquery('SELECT * FROM `vtiger_field` WHERE `columnname` = ? AND `uitype` IN (?,?,?);', [$columnname, 15, 16, 33]);
if (!$adb->num_rows($result)) {
$adb->query('drop table vtiger_' . $columnname);
//To Delete Sequence Table
if (Vtiger_Utils::CheckTable('vtiger_' . $columnname . '_seq')) {
$adb->query('drop table vtiger_' . $columnname . '_seq');
}
$adb->pquery('delete from vtiger_picklist where name=? ', array($columnname));
}
$adb->pquery('delete from vtiger_picklist_dependency where `tabid` = ? AND (sourcefield=? or targetfield=?)', array($tabId, $columnname, $columnname));
}
}
示例4: register
/**
* Handle event registration for module
* @param Vtiger_Module Instance of the module to use
* @param String Name of the Event like vtiger.entity.aftersave, vtiger.entity.beforesave
* @param String Name of the Handler class (should extend VTEventHandler)
* @param String File path which has Handler class definition
* @param String Condition for the event to trigger (default blank)
*/
static function register($moduleInstance, $eventname, $classname, $filename, $condition = '', $dependent = '[]')
{
// Security check on fileaccess, don't die if it fails
if (Vtiger_Utils::checkFileAccess($filename, false)) {
$adb = PearDatabase::getInstance();
$eventsManager = new VTEventsManager($adb);
$eventsManager->registerHandler($eventname, $filename, $classname, $condition, $dependent);
$eventsManager->setModuleForHandler($moduleInstance->name, $classname);
self::log("Registering Event {$eventname} with [{$filename}] {$classname} ... DONE");
}
}
示例5: getImportInfoById
public static function getImportInfoById($importId)
{
$db = PearDatabase::getInstance();
if (Vtiger_Utils::CheckTable('vtiger_import_queue')) {
$queueResult = $db->pquery('SELECT * FROM vtiger_import_queue WHERE importid=?', array($importId));
if ($queueResult && $db->num_rows($queueResult) > 0) {
$rowData = $db->raw_query_result_rowdata($queueResult, 0);
return self::getImportInfoFromResult($rowData);
}
}
return null;
}
示例6: isLockedForModule
public static function isLockedForModule($module)
{
$adb = PearDatabase::getInstance();
if (Vtiger_Utils::CheckTable('vtiger_import_locks')) {
$lockResult = $adb->pquery('SELECT * FROM vtiger_import_locks WHERE tabid=?', array(getTabid($module)));
if ($lockResult && $adb->num_rows($lockResult) > 0) {
$lockInfo = $adb->query_result_rowdata($lockResult, 0);
return $lockInfo;
}
}
return null;
}
示例7: getInstance
public static function getInstance($value)
{
$db = PearDatabase::getInstance();
if (Vtiger_Utils::isNumber($value)) {
$sql = 'SELECT * FROM vtiger_org_share_action_mapping WHERE share_action_id = ?';
} else {
$sql = 'SELECT * FROM vtiger_org_share_action_mapping WHERE share_action_name = ?';
}
$params = array($value);
$result = $db->pquery($sql, $params);
if ($db->num_rows($result) > 0) {
return self::getInstanceFromQResult($result);
}
return null;
}
示例8: getInstance
public static function getInstance($id)
{
$db = PearDatabase::getInstance();
if (Vtiger_Utils::isNumber($id)) {
$query = 'SELECT * FROM ' . Settings_Currency_Module_Model::tableName . ' WHERE id=?';
} else {
$query = 'SELECT * FROM ' . Settings_Currency_Module_Model::tableName . ' WHERE currency_name=?';
}
$params = array($id);
$result = $db->pquery($query, $params);
if ($db->num_rows($result) > 0) {
$instance = new self();
$row = $db->query_result_rowdata($result, 0);
$instance->setData($row);
}
return $instance;
}
示例9: registerCustomWebservices
function registerCustomWebservices($operations)
{
global $adb;
foreach ($operations as $operation_name => $operation_info) {
$checkres = $adb->pquery("SELECT operationid FROM vtiger_ws_operation WHERE name=?", array($operation_name));
if ($checkres && $adb->num_rows($checkres) < 1) {
$operation_id = $adb->getUniqueId('vtiger_ws_operation');
$operation_res = $adb->pquery("INSERT INTO vtiger_ws_operation (operationid, name, handler_path, handler_method, type, prelogin) \n\t\t\t\t\tVALUES (?,?,?,?,?,?)", array($operation_id, $operation_name, $operation_info['file'], $operation_info['handler'], $operation_info['reqtype'], $operation_info['prelogin']));
$operation_parameters = $operation_info['parameters'];
$parameter_index = 0;
foreach ($operation_parameters as $parameter_name => $parameter_type) {
$adb->pquery("INSERT INTO vtiger_ws_operation_parameters (operationid, name, type, sequence) \n\t\t\t\t\t\tVALUES(?,?,?,?)", array($operation_id, $parameter_name, $parameter_type, $parameter_index + 1));
++$parameter_index;
}
Vtiger_Utils::Log("Opearation {$operation_name} enabled successfully.");
} else {
Vtiger_Utils::Log("Operation {$operation_name} already exists.");
}
}
}
示例10: __initSchema
/**
* Initialize Layout Schema
* @access private
*/
static function __initSchema()
{
$hastable = Vtiger_Utils::CheckTable(self::TABLENAME);
if (!$hastable) {
Vtiger_Utils::CreateTable(self::TABLENAME, '(id INT NOT NULL PRIMARY KEY,
name VARCHAR(50), label VARCHAR(30), lastupdated DATETIME, isdefault INT(1), active INT(1))', true);
}
}
示例11: import_Tables
/**
* Import Tables of the module
* @access private
*/
function import_Tables($modulenode)
{
if (empty($modulenode->tables) || empty($modulenode->tables->table)) {
return;
}
/**
* Record the changes in schema file
*/
$schemafile = @fopen("modules/{$modulenode->name}/schema.xml", 'w');
if ($schemafile) {
fwrite($schemafile, "<?xml version='1.0'?>\n");
fwrite($schemafile, "<schema>\n");
fwrite($schemafile, "\t<tables>\n");
}
// Import the table via queries
foreach ($modulenode->tables->table as $tablenode) {
$tablename = $tablenode->name;
$tablesql = "{$tablenode->sql}";
// Convert to string format
// Save the information in the schema file.
if ($schemafile) {
fwrite($schemafile, "\t\t<table>\n");
fwrite($schemafile, "\t\t\t<name>{$tablename}</name>\n");
fwrite($schemafile, "\t\t\t<sql><![CDATA[{$tablesql}]]></sql>\n");
fwrite($schemafile, "\t\t</table>\n");
}
// Avoid executing SQL that will DELETE or DROP table data
if (Vtiger_Utils::IsCreateSql($tablesql)) {
if (!Vtiger_Utils::checkTable($tablename)) {
self::log("SQL: {$tablesql} ... ", false);
Vtiger_Utils::ExecuteQuery($tablesql);
self::log("DONE");
}
} else {
if (Vtiger_Utils::IsDestructiveSql($tablesql)) {
self::log("SQL: {$tablesql} ... SKIPPED");
} else {
self::log("SQL: {$tablesql} ... ", false);
Vtiger_Utils::ExecuteQuery($tablesql);
self::log("DONE");
}
}
}
if ($schemafile) {
fwrite($schemafile, "\t</tables>\n");
fwrite($schemafile, "</schema>\n");
fclose($schemafile);
}
}
示例12: handle_Migration
/**
* Handle migration of the module
* @access private
*/
function handle_Migration($modulenode, $moduleInstance)
{
// TODO Handle module migration SQL
$this->parse_Migration($modulenode);
$cur_version = $moduleInstance->version;
foreach ($this->_migrations as $migversion => $migrationnode) {
// Perform migration only for higher version than current
if (version_compare($cur_version, $migversion, '<')) {
self::log("Migrating to {$migversion} ... STARTED");
if (!empty($migrationnode->tables) && !empty($migrationnode->tables->table)) {
foreach ($migrationnode->tables->table as $tablenode) {
$tablename = $tablenode->name;
$tablesql = "{$tablenode->sql}";
// Convert to string
// Skip SQL which are destructive
if (Vtiger_Utils::IsDestructiveSql($tablesql)) {
self::log("SQL: {$tablesql} ... SKIPPED");
} else {
// Supress any SQL query failures
self::log("SQL: {$tablesql} ... ", false);
Vtiger_Utils::ExecuteQuery($tablesql, true);
self::log("DONE");
}
}
}
self::log("Migrating to {$migversion} ... DONE");
}
}
}
示例13: initializeSchema
/**
* Initialize the schema.
*/
protected static function initializeSchema()
{
if (!self::$schemaInitialized) {
if (!Vtiger_Utils::CheckTable('vtiger_cron_task')) {
Vtiger_Utils::CreateTable('vtiger_cron_task', '(id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(100) UNIQUE KEY, handler_file VARCHAR(100) UNIQUE KEY,
frequency int, laststart int(11) unsigned, lastend int(11) unsigned, status int,module VARCHAR(100),
sequence int,description TEXT )', true);
}
self::$schemaInitialized = true;
}
}
示例14: import_Tables
/**
* Import Tables of the module
* @access private
*/
function import_Tables($modulenode)
{
if (empty($modulenode->tables) || empty($modulenode->tables->table)) {
return;
}
$adb = PearDatabase::getInstance();
$adb->query('SET FOREIGN_KEY_CHECKS = 0;');
/**
* Record the changes in schema file
*/
if (file_exists("modules/{$modulenode->name}")) {
$fileToOpen = "modules/{$modulenode->name}/schema.xml";
} else {
if (file_exists("modules/Settings/{$modulenode->name}")) {
$fileToOpen = "modules/Settings/{$modulenode->name}/schema.xml";
}
}
$schemafile = fopen($fileToOpen, 'w');
if ($schemafile) {
fwrite($schemafile, "<?xml version='1.0'?>\n");
fwrite($schemafile, "<schema>\n");
fwrite($schemafile, "\t<tables>\n");
}
// Import the table via queries
foreach ($modulenode->tables->table as $tablenode) {
$tablename = $tablenode->name;
$tablesql = "{$tablenode->sql}";
// Convert to string format
// Save the information in the schema file.
fwrite($schemafile, "\t\t<table>\n");
fwrite($schemafile, "\t\t\t<name>{$tablename}</name>\n");
fwrite($schemafile, "\t\t\t<sql><![CDATA[{$tablesql}]]></sql>\n");
fwrite($schemafile, "\t\t</table>\n");
// Avoid executing SQL that will DELETE or DROP table data
if (Vtiger_Utils::IsCreateSql($tablesql)) {
if (!Vtiger_Utils::checkTable($tablename)) {
self::log("SQL: {$tablesql} ... ", false);
Vtiger_Utils::ExecuteQuery($tablesql);
self::log("DONE");
}
} else {
if (Vtiger_Utils::IsDestructiveSql($tablesql)) {
self::log("SQL: {$tablesql} ... SKIPPED");
} else {
self::log("SQL: {$tablesql} ... ", false);
Vtiger_Utils::ExecuteQuery($tablesql);
self::log("DONE");
}
}
}
if ($schemafile) {
fwrite($schemafile, "\t</tables>\n");
fwrite($schemafile, "</schema>\n");
fclose($schemafile);
}
$adb->query('SET FOREIGN_KEY_CHECKS = 1;');
}
示例15: getAll
/**
* Get all the language information
* @param Boolean true to include in-active languages also, false (default)
*/
static function getAll($includeInActive = false)
{
global $adb;
$hastable = Vtiger_Utils::CheckTable(self::TABLENAME);
$languageinfo = array();
if ($hastable) {
if ($includeInActive) {
$result = $adb->pquery('SELECT * FROM ' . self::TABLENAME, array());
} else {
$result = $adb->pquery('SELECT * FROM ' . self::TABLENAME . ' WHERE active=?', array(1));
}
for ($index = 0; $index < $adb->num_rows($result); ++$index) {
$resultrow = $adb->fetch_array($result);
$prefix = $resultrow['prefix'];
$label = $resultrow['label'];
$languageinfo[$prefix] = $label;
}
} else {
global $languages;
foreach ($languages as $prefix => $label) {
$languageinfo[$prefix] = $label;
}
}
// SalesPlatform.ru begin Set ru_ru to first position
if ($languageinfo['ru_ru']) {
$ruLabel = $languageinfo['ru_ru'];
unset($languageinfo['ru_ru']);
$languageinfo = array_merge(array('ru_ru' => $ruLabel), $languageinfo);
}
// SalesPlatform.ru end
return $languageinfo;
}