コード例 #1
0
ファイル: Tab.php プロジェクト: greench/prestashop
 /**
  * Get tab id from name
  *
  * @param string class_name
  * @return int id_tab
  */
 public static function getIdFromClassName($class_name)
 {
     if (self::$_getIdFromClassName === null) {
         self::$_getIdFromClassName = array();
         $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT id_tab, class_name FROM `' . _DB_PREFIX_ . 'tab`');
         foreach ($result as $row) {
             self::$_getIdFromClassName[$row['class_name']] = $row['id_tab'];
         }
     }
     return isset(self::$_getIdFromClassName[$class_name]) ? (int) self::$_getIdFromClassName[$class_name] : false;
 }
コード例 #2
0
ファイル: Tab.php プロジェクト: jpodracky/dogs
 /**
  * Get tab id from name
  *
  * @param string $class_name
  * @return int id_tab
  */
 public static function getIdFromClassName($class_name)
 {
     $class_name = strtolower($class_name);
     if (self::$_getIdFromClassName === null) {
         self::$_getIdFromClassName = array();
         $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT id_tab, class_name FROM `' . _DB_PREFIX_ . 'tab`', true, false);
         if (is_array($result)) {
             foreach ($result as $row) {
                 self::$_getIdFromClassName[strtolower($row['class_name'])] = $row['id_tab'];
             }
         }
     }
     return isset(self::$_getIdFromClassName[$class_name]) ? (int) self::$_getIdFromClassName[$class_name] : false;
 }