Esempio n. 1
0
 public function index()
 {
     $models = $this->db->where("siteid = %d", $this->siteid)->select();
     $types = $this->type_db->where("siteid = %d", $this->siteid)->select();
     $this->assign("types", array_translate($types));
     $this->assign("models", $models);
     $this->display();
 }
Esempio n. 2
0
 public function contentList($where = array(), $order = "id desc", $limit = 20, $page_params = array())
 {
     $module_fields = $this->getListFields();
     $list_fields = array('id', 'listorder');
     $list_fields = array_merge($list_fields, array_translate($module_fields, 'fieldid', 'field'));
     array_push($list_fields, 'inputtime', 'updatetime');
     return $this->getList($where, $order, $limit, $list_fields, $page_params);
 }
 public function contentList($where = array(), $order = "id desc", $limit = 20, $page_params = array())
 {
     $module_fields = $this->getListFields();
     $list_fields = array('id', 'listorder');
     $list_fields = array_merge($list_fields, array_translate($module_fields, 'fieldid', 'field'));
     array_push($list_fields, 'inputtime', 'updatetime');
     $content = $this->field($list_fields)->where(array_merge(array('siteid' => get_siteid()), $where))->order($order)->page((isset($_GET['p']) ? $_GET['p'] : 0) . ', ' . $limit)->select();
     $count = $this->where(array_merge(array('siteid' => get_siteid()), $where))->count();
     $Page = new Page($count, $limit);
     if ($page_params) {
         foreach ($page_params as $key => $param) {
             $Page->setConfig($key, $param);
         }
     }
     $show = $Page->show();
     return array("data" => $content, "page" => $show);
 }
Esempio n. 4
0
 function getPositionCheckbox($model, $id = NULL, $type = 'house')
 {
     import("ORG.Util.Form");
     // 载入推荐位
     $positions = $this->table(array(C('DB_PREFIX') . "model_type" => "type", C('DB_PREFIX') . "position" => "pos"))->where("type.id = pos.typeid and type.module = '%s'", $model)->order("pos.listorder desc")->field('pos.*')->select();
     $position_array = array_translate($positions);
     if (!empty($id)) {
         // 获取选中推荐位
         $posids = D('PositionData')->where(array('type' => $type, 'module' => $model, 'id' => $id))->group("posid")->field('posid')->select();
     }
     $position_data_ids = array();
     foreach ($posids as $key => $pos) {
         $position_data_ids[] = $pos['posid'];
     }
     $posids = implode(',', $position_data_ids);
     $posidstr = form::checkbox($position_array, $posids, "name='info[posids][]'", '', 125);
     // END 推荐位载入
     return $posidstr;
 }
 public function ajax_linkage_select()
 {
     $parentid = intval($_GET['parentid']);
     if ($parentid > 0) {
         $menus = $this->db->where(array('parentid' => $parentid))->order('listorder asc, id asc')->select();
         $menus = array_translate($menus);
         $options = "";
         foreach ($menus as $key => $value) {
             $options .= "<option value='" . $key . "'>" . $value . "</option>";
         }
         echo $options;
     }
 }
 /**
  * 推荐位添加模型加载
  */
 public function public_model_load()
 {
     $typeid = intval($_GET['typeid']);
     $models = D('Model')->where(array('typeid' => $typeid, 'siteid' => $this->siteid))->select();
     $modelstr = \Org\Util\Form::select(array_translate($models), '', 'name="info[modelid]" onchange="category_load(this);"', '所有模型');
     echo $modelstr;
 }
 /**
  * 推荐位添加模型加载
  */
 public function public_model_load()
 {
     import('ORG.Util.Form');
     $typeid = intval($_GET['typeid']);
     $models = D('Model')->where('typeid = %d', $typeid)->select();
     $modelstr = form::select(array_translate($models), '', 'name="info[modelid]" onchange="category_load(this);"', '选择模型');
     echo $modelstr;
 }
Esempio n. 8
0
 function test_array_translate()
 {
     $config = array('A' => 'X', 'B' => 'X');
     // Empty config always returns the array
     $this->assertIdentical(array_translate(array(), array()), array());
     $this->assertIdentical(array_translate(array('A', 'B', 'C'), array()), array());
     // Empty array always returns itself
     $this->assertIdentical(array_translate(array(), $config), array());
     // Items in config are converted
     $this->assertIdentical(array_translate(array('A'), $config), array('X'));
     $this->assertIdentical(array_translate(array('A', 'B'), $config), array('X'));
     // Items not in config are not converted
     $this->assertIdentical(array_translate(array('A', 'B', 'C'), $config), array('X', 'C'));
     // Order is preserved
     $this->assertIdentical(array_translate(array('C', 'A', 'B'), $config), array('C', 'X'));
     $this->assertIdentical(array_translate(array('B', 'C', 'A'), $config), array('X', 'C'));
     // Duplicates are removed
     $this->assertIdentical(array_translate(array('A', 'C', 'B', 'C', 'A'), $config), array('X', 'C'));
     // The threshold must be reached
     $this->assertIdentical(array_translate(array('A'), $config, 2), array('A'));
     $this->assertIdentical(array_translate(array('A', 'B'), $config, 2), array('X'));
     $this->assertIdentical(array_translate(array('A', 'C'), $config, 2), array('A', 'C'));
     $this->assertIdentical(array_translate(array('A', 'B', 'C'), $config, 2), array('X', 'C'));
     $this->assertIdentical(array_translate(array('A', 'C', 'B'), $config, 2), array('X', 'C'));
     $this->assertIdentical(array_translate(array('A', 'B', 'C'), $config, 3), array('A', 'B', 'C'));
 }