本文整理汇总了PHP中Vtiger_Utils::CreateTable方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Utils::CreateTable方法的具体用法?PHP Vtiger_Utils::CreateTable怎么用?PHP Vtiger_Utils::CreateTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Utils
的用法示例。
在下文中一共展示了Vtiger_Utils::CreateTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setRelatedList
/**
* 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')
{
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) VALUES(?,?,?,?,?,?,?,?)", array($relation_id, $this->id, $moduleInstance->id, $function_name, $sequence, $label, $presence, $useactions_text));
self::log("Setting relation with {$moduleInstance->name} [{$useactions_text}] ... DONE");
}
示例2: setRelatedList
/**
* 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, $functionName = 'get_related_list')
{
$adb = PearDatabase::getInstance();
if (empty($moduleInstance)) {
return;
}
if (empty($label)) {
$label = $moduleInstance->name;
}
$result = $adb->pquery('SELECT relation_id FROM vtiger_relatedlists WHERE tabid=? AND related_tabid = ? AND name = ? AND label = ?;', [$this->id, $moduleInstance->id, $functionName, $label]);
if ($result->rowCount() > 0) {
self::log("Setting relation with {$moduleInstance->name} [{$useactions_text}] ... Error, the related module already exists");
return;
}
$sequence = $this->__getNextRelatedListSequence();
$presence = 0;
// 0 - Enabled, 1 - Disabled
// Allow ADD action of other module records (default)
if ($actions === false) {
$actions = ['ADD'];
}
$useactionsText = $actions;
if (is_array($actions)) {
$useactionsText = implode(',', $actions);
}
$useactionsText = strtoupper($useactionsText);
$adb->insert('vtiger_relatedlists', ['relation_id' => $adb->getUniqueID('vtiger_relatedlists'), 'tabid' => $this->id, 'related_tabid' => $moduleInstance->id, 'name' => $functionName, 'sequence' => $sequence, 'label' => $label, 'presence' => $presence, 'actions' => $useactionsText]);
if ($functionName == 'get_many_to_many') {
$refTableName = Vtiger_Relation_Model::getReferenceTableInfo($moduleInstance->name, $this->name);
if (!Vtiger_Utils::CheckTable($refTableName['table'])) {
Vtiger_Utils::CreateTable($refTableName['table'], '(crmid INT(19) ,relcrmid INT(19),KEY crmid (crmid),KEY relcrmid (relcrmid))', true);
}
}
self::log("Setting relation with {$moduleInstance->name} [{$useactions_text}] ... DONE");
}
示例3: lock
public static function lock($importId, $module, $user)
{
$adb = PearDatabase::getInstance();
if (!Vtiger_Utils::CheckTable('vtiger_import_locks')) {
Vtiger_Utils::CreateTable('vtiger_import_locks', "(vtiger_import_lock_id INT NOT NULL PRIMARY KEY,\n\t\t\t\tuserid INT NOT NULL,\n\t\t\t\ttabid INT NOT NULL,\n\t\t\t\timportid INT NOT NULL,\n\t\t\t\tlocked_since DATETIME)", true);
}
$adb->pquery('INSERT INTO vtiger_import_locks VALUES(?,?,?,?,?)', array($adb->getUniqueID('vtiger_import_locks'), $user->id, getTabid($module), $importId, date('Y-m-d H:i:s')));
}
示例4: __initSchema
/**
* Initialize the schema (tables)
*/
static function __initSchema()
{
if (empty(self::$__cacheSchemaChanges['vtiger_links'])) {
if (!Vtiger_Utils::CheckTable('vtiger_links')) {
Vtiger_Utils::CreateTable('vtiger_links', '(linkid INT NOT NULL PRIMARY KEY,
tabid INT, linktype VARCHAR(20), linklabel VARCHAR(30), linkurl VARCHAR(255), linkicon VARCHAR(100), sequence INT, status INT(1) NOT NULL DEFAULT 1)', true);
Vtiger_Utils::ExecuteQuery('CREATE INDEX link_tabidtype_idx on vtiger_links(tabid,linktype)');
}
self::$__cacheSchemaChanges['vtiger_links'] = true;
}
}
示例5: __initSchema
/**
* Initialize Language 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), prefix VARCHAR(10), label VARCHAR(30), lastupdated DATETIME, sequence INT, isdefault INT(1), active INT(1))', true);
global $languages, $adb;
foreach ($languages as $langkey => $langlabel) {
$uniqueid = self::__getUniqueId();
$adb->pquery('INSERT INTO ' . self::TABLENAME . '(id,name,prefix,label,lastupdated,active) VALUES(?,?,?,?,?,?)', array($uniqueid, $langlabel, $langkey, $langlabel, date('Y-m-d H:i:s', time()), 1));
}
}
}
示例6: add
public static function add($request, $user)
{
$db = PearDatabase::getInstance();
if (!Vtiger_Utils::CheckTable('vtiger_import_queue')) {
Vtiger_Utils::CreateTable('vtiger_import_queue', "(importid INT NOT NULL PRIMARY KEY,\n\t\t\t\t\t\t\t\tuserid INT NOT NULL,\n\t\t\t\t\t\t\t\ttabid INT NOT NULL,\n\t\t\t\t\t\t\t\tfield_mapping TEXT,\n\t\t\t\t\t\t\t\tdefault_values TEXT,\n\t\t\t\t\t\t\t\tmerge_type INT,\n\t\t\t\t\t\t\t\tmerge_fields TEXT,\n\t\t\t\t\t\t\t\tstatus INT default 0)", true);
}
if ($request->get('is_scheduled')) {
$status = self::$IMPORT_STATUS_SCHEDULED;
} else {
$status = self::$IMPORT_STATUS_NONE;
}
$db->pquery('INSERT INTO vtiger_import_queue VALUES(?,?,?,?,?,?,?,?)', array($db->getUniqueID('vtiger_import_queue'), $user->id, getTabid($request->get('module')), Zend_Json::encode($request->get('field_mapping')), Zend_Json::encode($request->get('default_values')), $request->get('merge_type'), Zend_Json::encode($request->get('merge_fields')), $status));
}
示例7: save
function save()
{
$adb = PearDatabase::getInstance();
if (count($this->fieldData) == 0) {
return;
}
if (!Vtiger_Utils::CheckTable($this->tableName)) {
Vtiger_Utils::CreateTable($this->tableName, "(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t\t\tuserid INT NOT NULL,\n\t\t\t\t\tentitytype VARCHAR(200) NOT NULL,\n\t\t\t\t\tcrmid INT NOT NULL)", true);
}
$fieldNames = array_keys($this->fieldData);
$fieldValues = array_values($this->fieldData);
$adb->pquery('INSERT INTO ' . $this->tableName . '(' . implode(',', $fieldNames) . ') VALUES (' . generateQuestionMarks($fieldValues) . ')', array($fieldValues));
}
示例8: __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);
}
}
示例9: initTables
/**
* Initialize table required for the module
* @param String Base table name (default modulename in lowercase)
* @param String Base table column (default modulenameid in lowercase)
*
* Creates basetable, customtable, grouptable <br>
* customtable name is basetable + 'cf'<br>
* grouptable name is basetable + 'grouprel'<br>
*/
function initTables($basetable = false, $basetableid = false)
{
$this->basetable = $basetable;
$this->basetableid = $basetableid;
// Initialize tablename and index column names
$lcasemodname = strtolower($this->name);
if (!$this->basetable) {
$this->basetable = "vtiger_{$lcasemodname}";
}
if (!$this->basetableid) {
$this->basetableid = $lcasemodname . 'id';
}
if (!$this->customtable) {
$this->customtable = $this->basetable . 'cf';
}
Vtiger_Utils::CreateTable($this->basetable, "({$this->basetableid} int(19) PRIMARY KEY, CONSTRAINT `fk_1_{$this->basetable}` FOREIGN KEY (`{$this->basetableid}`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE)", true);
Vtiger_Utils::CreateTable($this->customtable, "({$this->basetableid} int(19) PRIMARY KEY, CONSTRAINT `fk_1_{$this->customtable}` FOREIGN KEY (`{$this->basetableid}`) REFERENCES `{$this->basetable}` (`{$this->basetableid}`) ON DELETE CASCADE)", true);
if ($this->type == 'SupplieModule') {
Vtiger_Utils::CreateTable($this->basetable . '_supfield', "(id int(19) AUTO_INCREMENT PRIMARY KEY, columnname varchar(30) NOT NULL,suptype varchar(30) NOT NULL,\nfieldlabel varchar(50) NOT NULL,presence int(1) unsigned NOT NULL DEFAULT '1',defaultvalue varchar(255),sequence int(10) unsigned DEFAULT NULL,\nblock int(1) unsigned DEFAULT NULL,displaytype int(1) unsigned DEFAULT NULL)", true);
Vtiger_Utils::CreateTable($this->basetable . '_sups', "(id int(19) PRIMARY KEY)", true);
}
}
示例10: initializeSchema
public static function initializeSchema()
{
if (!Vtiger_Utils::CheckTable('vtiger_google_oauth')) {
Vtiger_Utils::CreateTable('vtiger_google_oauth', '(service varchar(64),request_token text,access_token text,userid int)', true);
}
}
示例11: 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;
}
}
示例12: setRelatedModules
/**
* Set relation between field and modules (UIType 10)
* @param Array List of module names
*
* @internal Creates table vtiger_fieldmodulerel if it does not exists
*/
function setRelatedModules($moduleNames)
{
// We need to create core table to capture the relation between the field and modules.
if (!Vtiger_Utils::CheckTable('vtiger_fieldmodulerel')) {
Vtiger_Utils::CreateTable('vtiger_fieldmodulerel', '(fieldid INT NOT NULL, module VARCHAR(100) NOT NULL, relmodule VARCHAR(100) NOT NULL, status VARCHAR(10), sequence INT)', true);
}
// END
global $adb;
foreach ($moduleNames as $relmodule) {
$checkres = $adb->pquery('SELECT * FROM vtiger_fieldmodulerel WHERE fieldid=? AND module=? AND relmodule=?', array($this->id, $this->getModuleName(), $relmodule));
// If relation already exist continue
if ($adb->num_rows($checkres)) {
continue;
}
$adb->pquery('INSERT INTO vtiger_fieldmodulerel(fieldid, module, relmodule) VALUES(?,?,?)', array($this->id, $this->getModuleName(), $relmodule));
self::log("Setting {$this->name} relation with {$relmodule} ... DONE");
}
return true;
}
示例13: intialiseUpdateSchema
/**
* Creates sync table if not exists
*/
private static function intialiseUpdateSchema()
{
if (!Vtiger_Utils::CheckTable('vtiger_google_sync')) {
Vtiger_Utils::CreateTable('vtiger_google_sync', '(googlemodule varchar(50),user int(10), synctime datetime,lastsynctime datetime)', true);
}
}
示例14: IN
$stateValues = Zend_Json::decode(decode_html($stateValuesJson));
$appKey[] = $stateValues['synctrackerid'];
}
if (!empty($appKey)) {
$sql = 'UPDATE vtiger_wsapp SET name = ? WHERE appkey IN (' . generateQuestionMarks($appKey) . ')';
$res = Migration_Index_View::ExecuteQuery($sql, array('Google_vtigerSyncHandler', $appKey));
}
//Ends 141
//Google Calendar sync changes
/**
* Please refer this trac (http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/8354#comment:3)
* for configuration of vtiger to Google OAuth2
*/
global $adb;
if (!Vtiger_Utils::CheckTable('vtiger_google_oauth2')) {
Vtiger_Utils::CreateTable('vtiger_google_oauth2', '(service varchar(20),access_token varchar(500),refresh_token varchar(500),userid int(19))', true);
echo '<br> vtiger_google_oauth2 table created <br>';
}
//(start)Migrating GoogleCalendar ClientIds in wsapp_recordmapping to support v3
$syncTrackerIds = array();
if (Vtiger_Utils::CheckTable('vtiger_wsapp_sync_state')) {
$sql = 'SELECT stateencodedvalues from vtiger_wsapp_sync_state WHERE name = ?';
$result = $db->pquery($sql, array('Vtiger_GoogleCalendar'));
$num_of_rows = $adb->num_rows($result);
for ($i = 0; $i < $num_of_rows; $i++) {
$stateEncodedValues = $adb->query_result($result, $i, 'stateencodedvalues');
$htmlDecodedStateEncodedValue = decode_html($stateEncodedValues);
$stateDecodedValues = json_decode($htmlDecodedStateEncodedValue, true);
if (is_array($stateDecodedValues) && isset($stateDecodedValues['synctrackerid'])) {
$syncTrackerIds[] = $stateDecodedValues['synctrackerid'];
}
示例15: initTables
/**
* Initialize table required for the module
* @param String Base table name (default modulename in lowercase)
* @param String Base table column (default modulenameid in lowercase)
*
* Creates basetable, customtable, grouptable <br>
* customtable name is basetable + 'cf'<br>
* grouptable name is basetable + 'grouprel'<br>
*/
function initTables($basetable = false, $basetableid = false)
{
$this->basetable = $basetable;
$this->basetableid = $basetableid;
// Initialize tablename and index column names
$lcasemodname = strtolower($this->name);
if (!$this->basetable) {
$this->basetable = "vtiger_{$lcasemodname}";
}
if (!$this->basetableid) {
$this->basetableid = $lcasemodname . 'id';
}
if (!$this->customtable) {
$this->customtable = $this->basetable . 'cf';
}
Vtiger_Utils::CreateTable($this->basetable, "({$this->basetableid} int(19) PRIMARY KEY, CONSTRAINT `fk_1_{$this->basetable}` FOREIGN KEY (`{$this->basetableid}`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE)", true);
Vtiger_Utils::CreateTable($this->customtable, "({$this->basetableid} int(19) PRIMARY KEY, CONSTRAINT `fk_1_{$this->customtable}` FOREIGN KEY (`{$this->basetableid}`) REFERENCES `{$this->basetable}` (`{$this->basetableid}`) ON DELETE CASCADE)", true);
if ($this->type == 1) {
Vtiger_Utils::CreateTable($this->basetable . '_invfield', "(id int(19) AUTO_INCREMENT PRIMARY KEY, columnname varchar(30) NOT NULL, label varchar(50) NOT NULL, invtype varchar(30) NOT NULL,presence tinyint(1) unsigned NOT NULL DEFAULT '0',\n\t\t\t\tdefaultvalue varchar(255),sequence int(10) unsigned NOT NULL, block tinyint(1) unsigned NOT NULL,displaytype tinyint(1) unsigned NOT NULL DEFAULT '1', params text, colspan tinyint(1) unsigned NOT NULL DEFAULT '1')", true);
Vtiger_Utils::CreateTable($this->basetable . '_inventory', '(id int(19),seq int(10),KEY id (id),CONSTRAINT `fk_1_' . $this->basetable . '_inventory` FOREIGN KEY (`id`) REFERENCES `' . $this->basetable . '` (`' . $this->basetableid . '`) ON DELETE CASCADE)', true);
Vtiger_Utils::CreateTable($this->basetable . '_invmap', '(module varchar(50) PRIMARY KEY,field varchar(50),tofield varchar(50))', true);
}
}