Example #1
1
 /**
  * Prepare and sanitise the table data prior to saving.
  *
  * @param   JTable  $table  A reference to a JTable object.
  *
  * @return  void
  *
  * @since   12.2
  */
 protected function prepareTable($table)
 {
     require_once JDeveloperLIB . "/template.php";
     $type = $table->get("type", "");
     $dir = JDeveloperTEMPLATES . "/fields/formfields/" . $type . ".php";
     if ($table->id == 0 && JFile::exists($dir)) {
         $template = new JDeveloperTemplate($dir);
         $template->addAreas(array("header" => false));
         $template->addPlaceholders(array("name" => $table->name), true);
         $table->source = $template->getBuffer();
     }
 }
Example #2
0
 /**
  * Initialize the template
  *
  * @return	JDeveloperCreate	this
  */
 protected function initialize()
 {
     // standart placeholders
     $this->template->addAreas($this->getDefaultAreas());
     $this->template->addPlaceHolders($this->getDefaultPlaceholders(), true);
     return $this;
 }
Example #3
0
 /**
  * Prepare and sanitise the table data prior to saving.
  *
  * @param   JTable  $table  A reference to a JTable object.
  *
  * @return  void
  *
  * @since   12.2
  */
 protected function prepareTable($table)
 {
     require_once JDeveloperLIB . "/template.php";
     $dir = JDeveloperTEMPLATES . "/component/admin/models/rules/rule.php";
     if ($table->id == 0) {
         $template = new JDeveloperTemplate($dir);
         $template->addAreas(array("header" => false));
         $template->addPlaceholders(array("name" => $table->name), true);
         $table->source = $template->getBuffer();
     }
 }
Example #4
0
 public static function getTableSql($id)
 {
     require_once JDeveloperLIB . DS . 'template.php';
     $template = new JDeveloperTemplate(JDeveloperPath::dots2ds(JDeveloperTEMPLATES . DS . 'com.admin.sql.install.mysql.utf8.create.sql'));
     $table = JModelLegacy::getInstance('Table', 'JDeveloperModel')->getItem($id);
     $component = JModelLegacy::getInstance('Table', 'JDeveloperModel')->getItem($table->component);
     $fields = JModelLegacy::getInstance('Fields', 'JDeveloperModel')->getTableFields($table->id);
     if ($component === false) {
         $component = new JObject(array('name' => ''));
     }
     $template->addAreas(array('access' => (bool) $table->get('access', 0), 'alias' => (bool) $table->get('alias', 0), 'asset_id' => (bool) $table->get('asset_id', 0), 'catid' => (bool) $table->get('catid', 0), 'checked_out' => (bool) $table->get('checked_out', 0), 'created' => (bool) $table->get('created', 0), 'created_by' => (bool) $table->get('created_by', 0), 'created_by_alias' => (bool) $table->get('created_by_alias', 0), 'hits' => (bool) $table->get('hits', 0), 'language' => (bool) $table->get('language', 0), 'metadata' => (bool) $table->get('metadata', 0), 'metadesc' => (bool) $table->get('metadesc', 0), 'metakey' => (bool) $table->get('metakey', 0), 'modified' => (bool) $table->get('modified', 0), 'modified_by' => (bool) $table->get('modified_by', 0), 'ordering' => (bool) $table->get('ordering', 0), 'params' => !empty($table->params), 'publish' => (bool) $table->get('publish_up', 0) || (bool) $table->get('publish_down', 0), 'publish_up' => (bool) $table->get('publish_up', 0), 'publish_down' => (bool) $table->get('publish_down', 0), 'published' => (bool) $table->get('published', 0), 'tags' => false, 'version' => (bool) $table->get('version', 0)));
     $template->addPlaceholders(array('table_db' => JComponentHelper::getParams('com_jdeveloper')->get('add_component_name_to_table_name') ? $component->name . '_' . $table->name : $table->name, 'pk' => $table->pk, 'sql' => '<br>' . self::sqlFields($fields)));
     $buffer = $template->getBuffer();
     $buffer = preg_replace('/(CREATE TABLE IF NOT EXISTS|NOT NULL|CHARACTER SET|COLLATE|AUTO_INCREMENT|PRIMARY KEY|DEFAULT|COMMENT|unsigned)/', "<span style=\"color:blue\">\$0</span>", $buffer);
     $buffer = preg_replace('/`.*`/', "<span style=\"color:orange\">\$0</span>", $buffer);
     $buffer = preg_replace('/\'.*\'/', "<span style=\"color:#999999\">\$0</span>", $buffer);
     return $buffer;
 }