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


PHP Widget::tableName方法代碼示例

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


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

示例1: getSectionsArray

 public function getSectionsArray()
 {
     $attr = Widget::getI18nFieldName('title', 'Widget');
     $sql = 'SELECT ns.`id`, u.`' . $attr . '` FROM `' . Widget::tableName() . '` as u
             INNER JOIN `' . ModelBlog::tableName() . '` as ns
                 ON u.id = ns.widget_id
             WHERE u.`class` = "WidgetBlog" ORDER BY u.`' . $attr . '`';
     $result = Yii::app()->db->createCommand($sql)->queryAll();
     $ret = array();
     foreach ($result as $row) {
         $ret[$row['id']] = $row[$attr];
     }
     return $ret;
 }
開發者ID:rosko,項目名稱:Tempo-CMS,代碼行數:14,代碼來源:ModelBlog.php

示例2: actionInstall

 /**
  * Страница инсталляции/деинсталляции блоков
  */
 public function actionInstall()
 {
     $allUnits = ContentUnit::getAvailableUnits();
     $errors = array();
     if (isset($_POST['Units'])) {
         $units = array_keys($_POST['Units']);
         ContentUnit::install($units);
         $uninstall = array_diff(array_keys($allUnits), $units);
         foreach ($uninstall as $i => $className) {
             $sql = 'SELECT count(*) FROM `' . Widget::tableName() . '` WHERE `class` = :class';
             $command = Yii::app()->db->createCommand($sql);
             $command->bindValue(':class', $className, PDO::PARAM_STR);
             $exists = $command->queryScalar();
             if ($exists) {
                 unset($uninstall[$i]);
                 $errors[] = Yii::t('cms', 'Can\\`t unistall "{name}"', array('{name}' => $allUnits[$className]['name']));
             }
         }
         ContentUnit::uninstall($uninstall);
         $allUnits = ContentUnit::getAvailableUnits();
     }
     $this->render('install', array('units' => $allUnits, 'errors' => $errors));
 }
開發者ID:rosko,項目名稱:Tempo-CMS,代碼行數:26,代碼來源:UnitController.php

示例3: afterDelete

    public function afterDelete()
    {
        PageWidget::model()->deleteAll('page_id = :page_id', array(':page_id' => $this->id));
        // Удаляем все блоки, которые больше нигде не размещены
        $sql = 'SELECT `widget`.`id`, `widget`.`class`  FROM `' . Widget::tableName() . '` as `widget`
				LEFT JOIN `' . PageWidget::tableName() . '` as `pagewidget` ON (`widget`.`id` = `pagewidget`.`widget_id`)



		$pus = Yii::app()->db->createCommand($sql)->queryAll();
				WHERE `pagewidget`.`id` IS NULL';
        $ids = array();
        if ($pus && is_array($pus)) {
            foreach ($pus as $pu) {
                $ids[] = intval($pu['id']);
                $widgetClass = $pu['class'];
                $modelClass = call_user_func(array($widgetClass, 'modelClassName'));
                call_user_func(array($modelClass, 'model'))->deleteAll('widget_id = ' . intval($pu['id']));
            }
            $sql = 'DELETE FROM `' . Widget::tableName() . '` WHERE `id` IN (' . implode(',', $ids) . ')';
            Yii::app()->db->createCommand($sql)->execute();
        }
        return parent::afterDelete();
    }
開發者ID:rosko,項目名稱:Tempo-CMS,代碼行數:24,代碼來源:Page.php


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