示例#1
0
 function ajax($select = '*', $where = NULL, $ordering = null)
 {
     $return = array('data' => null, 'recordsTotal' => 0, 'recordsFiltered' => 0);
     $selectSQL = '*';
     $selectSQL .= ', ' . lang_query($this->table, 'content', 'lang.id', 'en', 'content_en');
     $this->db->select($selectSQL, false)->from($this->table . ' AS lang');
     $this->db->where('table', $this->table);
     $this->db->where('language', 'vn');
     if ($where) {
         $this->db->where($where);
     }
     // 	    $this->db->where('cat.status !=',-1);
     $tempdb = clone $this->db;
     $page = intval($this->input->get('start')) / PAGES_LIMIT + 1;
     if (!$page || $page < 1) {
         $page = 1;
     }
     $this->db->limit(PAGES_LIMIT, PAGES_LIMIT * ($page - 1));
     $data = $this->db->get()->result();
     // 	    	    bug( $this->db->last_query() );die;
     if ($data) {
         $select = explode(',', $select);
         foreach ($data as $val) {
             $row = NULL;
             foreach ($select as $field) {
                 $row[] = isset($val->{$field}) ? $val->{$field} : NULL;
             }
             $row[] = $this->permission->table_actions(1, $val->id, true, 'languages');
             $return['data'][] = $row;
         }
     }
     return $return;
 }
示例#2
0
 function ajax($select = '*', $where = NULL, $ordering = null)
 {
     $return = array('data' => null, 'recordsTotal' => 0, 'recordsFiltered' => 0);
     $selectSQL = '*';
     $selectSQL .= ', ' . lang_query($this->table, 'name', 'a.id');
     // 	    $selectSQL .= ', '.lang_query('category','name','a.category');
     $this->db->select($selectSQL, false)->from($this->table . ' AS a');
     $this->db->where('a.status !=', -1);
     if ($where) {
         $this->db->where($where);
     }
     $tempdb = clone $this->db;
     $page = intval($this->input->get('start')) / PAGES_LIMIT + 1;
     if (!$page || $page < 1) {
         $page = 1;
     }
     // 	    if( $this->input->get('order') ){
     // 	        $fields = explode(',',$select);
     // 	        $order = reset($this->input->get('order'));
     // 	        if ( isset($fields[$order['column']]) ){
     // 	            $this->db->order_by($fields[$order['column']],$order['dir']);
     // 	        }
     // 	    }
     $this->db->limit(PAGES_LIMIT, PAGES_LIMIT * ($page - 1));
     $data = $this->db->get()->result();
     // 	    bug( $this->db->last_query() );die;
     // 		$return = array('data'=>NULL,'draw'=>1,'draw','recordsTotal'=>10,'recordsFiltered'=>10);
     if ($data) {
         $select = explode(',', $select);
         $img_src = $this->config->item('resouce_url') . str_replace($this->config->item('resouce_dir'), null, $this->fields['img']['dir']);
         foreach ($data as $val) {
             $row = NULL;
             foreach ($select as $field) {
                 if ($field == 'img') {
                     $row[] = img($img_src . $val->{$field}, false, array('width' => 200));
                 } else {
                     $row[] = isset($val->{$field}) ? $val->{$field} : NULL;
                 }
             }
             $row[] = $this->permission->table_actions($val->status, $val->id, true, 'partners');
             $return['data'][] = $row;
         }
     }
     // 		bug($return);die;
     return $return;
 }
示例#3
0
 function ajax($select = '*', $where = NULL, $ordering = null)
 {
     $return = array('data' => null, 'recordsTotal' => 0, 'recordsFiltered' => 0);
     $selectSQL = '*';
     $selectSQL .= ', ' . lang_query($this->table, 'name', 'pro.id');
     $this->db->select($selectSQL, false)->from($this->table . ' AS pro');
     $this->db->where('pro.status >=', 0);
     if ($where) {
         $this->db->where($where);
     }
     $tempdb = clone $this->db;
     $page = intval($this->input->get('start')) / PAGES_LIMIT + 1;
     if (!$page || $page < 1) {
         $page = 1;
     }
     // 	    if( $this->input->get('order') ){
     // 	        $fields = explode(',',$select);
     // 	        $order = reset($this->input->get('order'));
     // 	        if ( isset($fields[$order['column']]) ){
     // 	            $this->db->order_by($fields[$order['column']],$order['dir']);
     // 	        }
     // 	    }
     $this->db->limit(PAGES_LIMIT, PAGES_LIMIT * ($page - 1));
     $data = $this->db->get()->result();
     if ($data) {
         $select = explode(',', $select);
         $img_src = $this->config->item('resouce_url') . str_replace($this->config->item('resouce_dir'), null, $this->fields['img']['dir']);
         foreach ($data as $val) {
             $row = NULL;
             foreach ($select as $field) {
                 if ($field == 'img') {
                     $row[] = img_show($val->{$field});
                 } elseif ($field == 'begin' or $field == 'end') {
                     $str_time = strtotime($val->{$field});
                     $row[] = $str_time ? date('d-m-Y', strtotime($val->{$field})) : NULL;
                 } else {
                     $row[] = isset($val->{$field}) ? $val->{$field} : NULL;
                 }
             }
             $row[] = $this->permission->table_actions($val->status, $val->id, true, 'products');
             $return['data'][] = $row;
         }
     }
     // 		bug($return);die;
     return $return;
 }
示例#4
0
 function product_by_alias($alias = null, $category_id = 0)
 {
     $table = 'product';
     $select = 'a.id, a.category, a.img, a.sku,a.price, c.content AS alias';
     $select .= ', ' . lang_query($table, 'name', 'a.id');
     $select .= ', ' . lang_query($table, 'description', 'a.id');
     $select .= ', ' . lang_query($table, 'content', 'a.id');
     $this->db->select($select)->from("{$table} AS a");
     $this->db->join('content AS c', "c.field ='alias' AND c.table='{$table}' AND c.taget= a.id AND c.language='" . $this->current_lang . "' ", 'left');
     $this->db->where('c.content', $alias);
     if ($category_id) {
         $this->db->where('a.category', $category_id);
     }
     $item = $this->db->get()->row();
     if (!strip_tags($item->content)) {
         $item->content = NULL;
     }
     return $item;
 }
示例#5
0
 private function items_by_level($where = NULL, $ordering = null, $parent = 0)
 {
     $selectSQL = '* , ' . lang_query('category', 'name', 'cat.id');
     $this->db->select($selectSQL, false)->from('category AS cat');
     $this->db->where('cat.status >=', 0);
     $this->db->where('cat.parent', $parent);
     if (is_array($where) && !empty($where)) {
         $this->db->where($where);
     }
     return $this->db->get()->result();
 }
示例#6
0
function create($kat, $title, $description, $pass_language_check = false)
{
    global $sess, $auth, $glob_language_name, $glob_language;
    if (!defined("SPELLING_INC")) {
        include "commonapi/spelling.inc";
    }
    if (!strstr($kat, '/')) {
        $kat = base64_decode($kat);
    }
    $predef['kat'] = $kat;
    $predef['title'] = $title;
    $predef['description'] = $description;
    $title = str_replace(' ', '_', $title);
    $exists = get_node_info($kat . $title);
    $exists = $exists != -1;
    if (strstr($title, '/')) {
        $errfile = "err_invalidslash.html";
        addform($predef, $errfile);
        exit;
    } elseif ($title == "") {
        $errfile = "err_notitle.html";
        addform($predef, $errfile);
        exit;
    } elseif ($description == "") {
        $errfile = "err_nodesc.html";
        addform($predef, $errfile);
        exit;
    } elseif ($exists) {
        $errfile = "err_object_exists.html";
        addform($predef, $errfile);
        exit;
    } elseif (!check_language($description, $glob_language_name) and !$pass_language_check) {
        lang_query($kat, $title, $description);
    } else {
        $title = str_replace(' ', '_', $title);
        $obj['name'] = $kat . $title;
        $obj['parent'] = path2id($kat);
        $obj['level'] = level_count($kat);
        $obj['objecttype'] = "trail";
        $obj['description'] = $description;
        $obj['useraccess'] = 4;
        $obj['friendaccess'] = 12;
        $obj['owner'] = $auth->auth["uid"];
        $obj['language'] = $glob_language;
        add_object($obj, true);
        Header("Location: " . $sess->url(build_good_url($obj['name']) . "?reloadparent=1"));
        exit;
        // echo("Debug: dieses Fenster schliessen");
    }
}