コード例 #1
0
 public function placement($primary = false)
 {
     $where = "placement_entry_id = " . $this->id;
     if ($primary) {
         $where .= " and placement_is_primary = 1";
     }
     require_once 'class.mt_placement.php';
     $place = new Placement();
     $places = $place->Find($where);
     return $places;
 }
コード例 #2
0
ファイル: mtdb.base.php プロジェクト: OCMO/movabletype
 public function cache_categories($entry_list)
 {
     $ids = null;
     foreach ($entry_list as $entry_id) {
         if (!isset($this->_cat_id_cache['e' . $entry_id])) {
             $ids[] = $entry_id;
         }
         $this->_cat_id_cache['e' . $entry_id] = null;
     }
     if (empty($ids)) {
         return;
     }
     $id_list = implode(",", $ids);
     if (empty($id_list)) {
         return;
     }
     $where = "placement_entry_id in ({$id_list})\n               and placement_is_primary = 1";
     $extras['join'] = array('mt_category' => array('condition' => "placement_category_id = category_id"));
     require_once 'class.mt_placement.php';
     $placement = new Placement();
     $rows = $placement->Find($where, false, false, $extras);
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $entry_id = $row->entry_id;
             $this->_cat_id_cache['e' . $entry_id] = $row;
             $cat_id = $row->category_id;
             if (!isset($this->_cat_id_cache['c' . $cat_id])) {
                 $cat = $row->category();
                 $this->_cat_id_cache['c' . $cat_id] = $cat;
             }
         }
     }
     return true;
 }