當前位置: 首頁>>代碼示例>>PHP>>正文


PHP XMLDBIndex::setComment方法代碼示例

本文整理匯總了PHP中XMLDBIndex::setComment方法的典型用法代碼示例。如果您正苦於以下問題:PHP XMLDBIndex::setComment方法的具體用法?PHP XMLDBIndex::setComment怎麽用?PHP XMLDBIndex::setComment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XMLDBIndex的用法示例。


在下文中一共展示了XMLDBIndex::setComment方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: invoke

 /**
  * Invoke method, every class will have its own
  * returns true/false on completion, setting both
  * errormsg and output as necessary
  */
 function invoke()
 {
     parent::invoke();
     $result = true;
     /// Set own core attributes
     $this->does_generate = ACTION_NONE;
     //$this->does_generate = ACTION_GENERATE_HTML;
     /// These are always here
     global $CFG, $XMLDB;
     /// Do the job, setting result as needed
     /// Get the dir containing the file
     $dirpath = required_param('dir', PARAM_PATH);
     $dirpath = $CFG->dirroot . stripslashes_safe($dirpath);
     /// Get the correct dirs
     if (!empty($XMLDB->dbdirs)) {
         $dbdir =& $XMLDB->dbdirs[$dirpath];
     } else {
         return false;
     }
     if (!empty($XMLDB->editeddirs)) {
         $editeddir =& $XMLDB->editeddirs[$dirpath];
         $structure =& $editeddir->xml_file->getStructure();
     }
     /// ADD YOUR CODE HERE
     $tableparam = required_param('table', PARAM_CLEAN);
     $table =& $structure->getTable($tableparam);
     /// If the changeme index exists, just get it and continue
     $changeme_exists = false;
     if ($indexes =& $table->getIndexes()) {
         if ($index =& $table->getIndex('changeme')) {
             $changeme_exists = true;
         }
     }
     if (!$changeme_exists) {
         /// Lets create the Index
         $index = new XMLDBIndex('changeme');
         $index->setComment('Default comment for the index, please edit me');
         $table->addIndex($index);
         /// We have one new key, so the structure has changed
         $structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
         $structure->setChanged(true);
     }
     /// Launch postaction if exists (leave this here!)
     if ($this->getPostAction() && $result) {
         return $this->launch($this->getPostAction());
     }
     /// Return ok if arrived here
     return $result;
 }
開發者ID:veritech,項目名稱:pare-project,代碼行數:54,代碼來源:new_index.class.php


注:本文中的XMLDBIndex::setComment方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。