コード例 #1
0
ファイル: Rights.php プロジェクト: kstep/pnut
 public function __construct(Model_Db $model)
 {
     $otype = strtolower(substr(get_class($model), 6));
     $oid = (int) $model->getId();
     if ($otype and $oid) {
         parent::__construct($model->getStorage(), array('object_type' => $otype, 'object_id' => $oid));
     }
     if (!$this->isLoaded()) {
         $this->otype = $otype;
         $this->oid = $oid;
     }
 }
コード例 #2
0
ファイル: Default.php プロジェクト: kstep/pnut
 public function init()
 {
     Model_List_Db::setVisibility('visible');
     Model_Db::setVisibility('visible');
 }
コード例 #3
0
ファイル: User.class.php プロジェクト: godruoyi/portal
 public function __construct()
 {
     parent::__construct('t_users', 'localhost_one');
 }
コード例 #4
0
ファイル: Db.php プロジェクト: kstep/pnut
 public static function setVisibility($value = "visible")
 {
     self::$_visibility = $value;
 }
コード例 #5
0
ファイル: CacheDb.class.php プロジェクト: godruoyi/portal
 /**
  * 查询
  * $cache_time = 0不使用缓存
  */
 public function select($where = array(), $attrs = array(), $cache_time = 0)
 {
     $use_cache = $cache_time > 0;
     $datas = array();
     $cacke_key = NULL;
     if ($use_cache) {
         ksort($where);
         ksort($attrs);
         $cache_key = $this->_conditionToCacheKey($where, $attrs);
         $datas = $this->_cache->get($cache_key);
         if (!empty($datas)) {
             return $datas;
         }
     }
     $datas = parent::select($where, $attrs);
     if (empty($datas)) {
         return $datas;
     }
     $datas = Helper_Array::changeKey($datas, $this->_primary_id);
     if ($use_cache) {
         $this->_cache->set($cache_key, $datas, $cache_time);
     }
     return $datas;
 }
コード例 #6
0
ファイル: Db.class.php プロジェクト: godruoyi/portal
 public static function setForceReadOnMaster($bool = TRUE)
 {
     Model_Db::$_forceReadOnMaster = $bool;
 }
コード例 #7
0
ファイル: Topic.php プロジェクト: kstep/pnut
 public function actionTrashcan($params)
 {
     Model_List_Db::setVisibility('');
     Model_Db::setVisibility('');
     $view = $this->htmlView("list_trashcan");
     $trashcan = new Model_Trashcan($this->getStorage());
     if ($_POST && isset($_POST['objects'])) {
         $mode = isset($_POST['restore']) ? 'restore' : (isset($_POST['cleanup']) ? 'cleanup' : '');
         if ($mode) {
             foreach ($_POST['objects'] as $oname => $idlist) {
                 $trashcan->{$mode}($oname, $idlist);
             }
         }
     }
     $olist = array();
     foreach (array('Статьи' => 'Article', 'Разделы' => 'Topic', 'Комментарии' => 'Comment') as $title => $oname) {
         $list = $trashcan->getList($oname);
         if (count($list)) {
             $olist[$title] = $list;
         }
         unset($list);
     }
     $view->trashcan = $olist;
     return $view;
 }