示例#1
0
 public function edit()
 {
     $data = array();
     $query = $this->db->select("A.*, A.`" . self::ID_UM . "` AS ID, B.`sort` AS SORT")->from("`" . self::UM . "` AS A")->join("`" . self::HM . "` AS B", "B.`" . self::ID_UM . "` = A.`" . self::ID_UM . "` && B.`id_m_menu` IS NULL", "left")->where("A.`" . self::ID_USERS . "`", $this->id_users)->order_by("B.`sort`")->order_by("ID");
     $result = $query->get()->result_array();
     foreach ($result as $ms) {
         if ($ms['SORT'] == NULL) {
             $data['checkbox'][$ms[self::ID_UM]] = array(self::ID_UM => $ms[self::ID_UM], 'alias' => $ms['alias']);
         } else {
             $data['checkbox_checked'][$ms[self::ID_UM]] = $ms;
         }
     }
     $query = $this->db->select("*")->from("`" . self::UHD . "`")->where("`" . self::ID_USERS . "`", $this->id_users);
     foreach ($query->get()->result_array() as $ms) {
         $data['home_desc']['home_desc'][$ms['id_langs']] = $ms;
     }
     $this->load->helper('home/home_helper');
     $this->load->model('langs/mlangs');
     $data['on_langs'] = $this->mlangs->get_active_languages();
     helper_menu_modules_form($data);
 }
示例#2
0
 public function menu_modules($id)
 {
     $query = $this->db->select("B.`name`")->from("`" . self::MENU . "` AS A")->join("`" . self::MENU_DESC . "` AS B", "B.`" . self::ID_MENU . "` = A.`" . self::ID_MENU . "` && B.`" . self::ID_LANGS . "` = " . $this->id_langs, "inner")->where("A.`" . self::ID_MENU . "`", $id)->where("A.`" . self::ID_USERS . "`", $this->id_users)->limit(1);
     $menu = $query->get()->row_array();
     $menu = $menu['name'];
     $this->template->add_title(' - ' . $menu);
     $this->template->add_navigation($menu);
     $data = array();
     $query = $this->db->select("A.*, A.`" . self::ID_U_M . "` AS ID, B.base_module, B.`sort` AS SORT")->from("`" . self::U_M . "` AS A")->join("`" . self::U_M_M . "` AS B", "B.`" . self::ID_U_M . "` = A.`" . self::ID_U_M . "` && B.`" . self::ID_MENU . "` = '" . $id . "'", "left")->where("A.`" . self::ID_USERS . "`", $this->id_users)->order_by("B.`sort`")->order_by("ID");
     $result = $query->get()->result_array();
     foreach ($result as $ms) {
         if ($ms['SORT'] == NULL) {
             $data['checkbox'][$ms[self::ID_U_M]] = array(self::ID_U_M => $ms[self::ID_U_M], 'alias' => $ms['alias']);
         } else {
             $data['checkbox_checked'][$ms[self::ID_U_M]] = $ms;
         }
     }
     /*		
     		$result = $query->get()->result_array();
     foreach($result as $ms)
     		{
     			$data['checkbox'][$ms[self::ID_U_M]] = array(self::ID_U_M => $ms[self::ID_U_M], 'alias' => $ms['alias']);
     		}
     $query = $this->db->select("A.*")
     				->from("`users_menu_modules` AS A")
     				->where("A.`".self::ID_MENU."`", $id)
     				->where("A.`id_users`", $this->id_users)->order_by('sort');
     		$result = $query->get()->result_array();
     		if(count($result)>0)
     		{
     			foreach($result as $ms)
     			{
     				$temp_ch[$ms[self::ID_U_M]] = $ms[self::ID_U_M];
     				//$data['checkbox_checked'][self::ID_U_M][$ms[self::ID_U_M]] = $ms[self::ID_U_M];
     			}
     			$temp = $data['checkbox'];
     			$data['checkbox'] = array();
     			foreach($temp as $ms)
     			{
     				if(isset($temp_ch[$ms[self::ID_U_M]]))
     				{
     					$data['checkbox_checked'][$ms[self::ID_U_M]] = $ms;
     				}
     				else
     				{
     					 $data['checkbox'][$ms[self::ID_U_M]] = $ms;
     				}
     			}
     		}
     */
     $this->load->helper('menu/menu_helper');
     helper_menu_modules_form($data, $id);
 }