/**
  *
  * craete tables
  */
 public static function createTable($tableName)
 {
     global $wpdb;
     //if table exists - don't create it.
     $tableRealName = $wpdb->prefix . $tableName;
     if (UniteFunctionsWPUG::isDBTableExists($tableRealName)) {
         return false;
     }
     $charset_collate = $wpdb->get_charset_collate();
     switch ($tableName) {
         case GlobalsUG::TABLE_CATEGORIES_NAME:
             $sql = "CREATE TABLE " . $tableRealName . " (\n\t\t\t\t\tid int(9) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\ttitle varchar(255) NOT NULL,\n\t\t\t\t\talias varchar(255),\n\t\t\t\t\tordering int not NULL,\n\t\t\t\t\tparams text NOT NULL,\n\t\t\t\t\ttype tinytext,\n\t\t\t\t\tparent_id int(9),\n\t\t\t\t\tPRIMARY KEY (id)\n\t\t\t\t\t){$charset_collate};";
             break;
         case GlobalsUG::TABLE_ITEMS_NAME:
             $sql = "CREATE TABLE " . $tableRealName . " (\n\t\t\t\t\tid int(9) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\tpublished int(2) NOT NULL,\n\t\t\t\t\ttitle tinytext NOT NULL,\n\t\t\t\t\talias tinytext,\n\t\t\t\t\ttype varchar(60),\n\t\t\t\t\turl_image tinytext,\n\t\t\t\t\turl_thumb tinytext,\n\t\t\t\t\tordering int not NULL,\n\t\t\t\t\tcatid int(9) NOT NULL,\n\t\t\t\t\timageid int(9),\n\t\t\t\t\tparams text,\n\t\t\t\t\tcontent text,\n\t\t\t\t\tcontentid varchar(60),\n\t\t\t\t\tparent_id int(9),\n\t\t\t\t\tPRIMARY KEY (id)\n\t\t\t\t\t){$charset_collate};";
             break;
         case GlobalsUG::TABLE_GALLERIES_NAME:
             $sql = "CREATE TABLE " . $tableRealName . " (\n\t\t\t\t\tid int(9) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\ttype varchar(60) NOT NULL,\n\t\t\t\t\ttitle tinytext NOT NULL,\n\t\t\t\t\talias tinytext,\n\t\t\t\t\tordering int not NULL,\n\t\t\t\t\tparams text,\n\t\t\t\t\tPRIMARY KEY (id)\n\t\t\t\t\t){$charset_collate};";
             break;
         default:
             UniteFunctionsMeg::throwError("table: {$tableName} not found");
             break;
     }
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     dbDelta($sql);
 }
 /**
  * 
  * init template by id
  */
 public function initById($templateID)
 {
     $arrData = $this->db->fetchSingle(GlobalsShowBiz::$table_templates, "id={$templateID}");
     if (empty($arrData)) {
         UniteFunctionsMeg::throwError("Tempalte with id: {$templateID} not found");
     }
     $this->initByData($arrData);
 }