Exemplo n.º 1
0
 function actPopup()
 {
     global $ST;
     parent::refresh();
     $cond = " WHERE 1 ";
     if ($this->getURIVal('usertype')) {
         $cond .= " AND type='" . SQL::slashes($this->getURIVal('usertype')) . "'";
     }
     $query = "SELECT count(*) AS c FROM sc_users" . $cond;
     $rs = $this->getStatement()->execute($query);
     if ($rs->next()) {
         $this->page->all = $rs->getInt('c');
     }
     $order = 'ORDER BY ';
     $ord = $this->getURIVal('ord') != 'asc' ? 'asc' : 'desc';
     if (in_array($this->getURIVal('sort'), array('login', 'u_id', 'status', 'type', 'city', 'company', 'balance', 'discount', 'bonus', 'visit', 'last_visit', 'reg_date'))) {
         $order .= $this->getURIVal('sort') . ' ' . $ord;
     } elseif ($this->getURIVal('sort') == 'fio') {
         $order .= 'last_name ' . $ord . ',first_name ' . $ord . ',middle_name ' . $ord;
     } else {
         $order .= 'type,u_id';
     }
     $queryStr = "SELECT * FROM sc_users {$cond} {$order} LIMIT " . $this->page->getBegin() . "," . $this->page->per;
     $this->rs = $ST->select($queryStr);
     $data['usertype'] = $this->enum('u_type');
     $this->tplContainer = 'core/tpl/admin/admin_popup.php';
     $this->display($data, dirname(__FILE__) . '/users_popup.tpl.php');
 }
Exemplo n.º 2
0
 function actDefault()
 {
     parent::refresh();
     $cond = " type='vendor' ";
     if ($this->getURIVal('hidden') != 1) {
         $cond .= " AND hide=0";
     }
     $query = "SELECT count(*) AS c FROM sc_users WHERE {$cond}";
     $rs = DB::select($query);
     if ($rs->next()) {
         $this->page->all = $rs->getInt('c');
     }
     $order = 'ORDER BY ';
     $ord = $this->getURIVal('ord') != 'asc' ? 'asc' : 'desc';
     if (in_array($this->getURIVal('sort'), array('login', 'u_id', 'status', 'type', 'company', 'balance', 'discount', 'bonus', 'visit', 'last_visit', 'reg_date'))) {
         $order .= $this->getURIVal('sort') . ' ' . $ord;
     } elseif ($this->getURIVal('sort') == 'fio') {
         $order .= 'last_name ' . $ord . ',first_name ' . $ord . ',middle_name ' . $ord;
     } else {
         $order .= 'type,u_id';
     }
     $q = "SELECT * FROM sc_users u\r\n\t\t\tLEFT JOIN sc_users_vendor v ON v.vendor_id=u.u_id\r\n\t\t\tLEFT JOIN (SELECT COUNT(id) ci,vendor FROM sc_shop_item GROUP BY vendor) AS cci ON cci.vendor=u.u_id\r\n\t\tWHERE {$cond} {$order} LIMIT " . $this->page->getBegin() . "," . $this->page->per;
     $data['rs'] = DB::select($q)->toArray();
     $this->display($data, dirname(__FILE__) . '/admin_vendor.tpl.php');
 }
Exemplo n.º 3
0
 function refresh()
 {
     parent::refresh();
     $query = "SELECT count(*) AS c FROM sc_letter_template";
     $rs = $this->getStatement()->execute($query);
     if ($rs->next()) {
         $this->page->all = $rs->getInt('c');
     }
     $queryStr = "select * from sc_letter_template LIMIT " . $this->page->getBegin() . "," . $this->page->per;
     $this->rs = $this->getStatement()->execute($queryStr);
 }
Exemplo n.º 4
0
 function refresh()
 {
     parent::refresh();
     $query = "SELECT count(*) AS c FROM sc_content";
     $rs = $this->getStatement()->execute($query);
     if ($rs->next()) {
         $this->page->all = $rs->getInt('c');
     }
     $queryStr = "SELECT * FROM sc_content ORDER BY c_name LIMIT " . $this->page->getBegin() . "," . $this->page->per . " ";
     $this->rs = $this->getStatement()->execute($queryStr);
 }
 function actDefault()
 {
     global $ST;
     parent::refresh();
     $queryStr = "SELECT count(*) AS c FROM sc_guestbook";
     $rs = $ST->select($queryStr);
     if ($rs->next()) {
         $this->page->all = $rs->getInt("c");
     }
     $order = "ORDER BY time DESC";
     $queryStr = "SELECT * FROM sc_guestbook  {$order} LIMIT " . $this->page->getBegin() . "," . $this->page->per;
     $this->rs = $ST->select($queryStr);
     $this->display(array(), dirname(__FILE__) . '/guestbook_list.tpl.php');
 }
Exemplo n.º 6
0
 function actAddr()
 {
     global $ST;
     parent::refresh();
     $queryStr = "SELECT count(*) AS c FROM sc_contacts_points";
     $rs = $ST->select($queryStr);
     if ($rs->next()) {
         $this->page->all = $rs->getInt("c");
     }
     $order = "ORDER BY id DESC";
     $queryStr = "SELECT * FROM sc_contacts_points {$order} LIMIT " . $this->page->getBegin() . "," . $this->page->per . "";
     $this->rs = $ST->select($queryStr);
     $this->setPageTitle('Адреса');
     $this->display(array(), dirname(__FILE__) . '/contacts_points_list.tpl.php');
 }
Exemplo n.º 7
0
 function actDefault()
 {
     global $ST;
     parent::refresh();
     $this->updateParams();
     $queryStr = "SELECT count(*) AS c FROM sc_faq WHERE type='" . $this->type . "'";
     $rs = $ST->select($queryStr);
     if ($rs->next()) {
         $this->page->all = $rs->getInt("c");
     }
     $order = "ORDER BY time ASC";
     $queryStr = "SELECT * FROM sc_faq WHERE type='" . $this->type . "' {$order} limit " . $this->page->getBegin() . "," . $this->page->per;
     $this->rs = $ST->select($queryStr);
     $this->display(array(), dirname(__FILE__) . '/faq_list.tpl.php');
 }
Exemplo n.º 8
0
 function actDefault()
 {
     global $ST;
     parent::refresh();
     $cnd = "1=1";
     $queryStr = "SELECT count(*) AS c FROM sc_shop_board b WHERE {$cnd}";
     $rs = $ST->select($queryStr);
     if ($rs->next()) {
         $this->page->all = $rs->getInt("c");
     }
     $order = "ORDER BY time ASC";
     $queryStr = "SELECT * FROM sc_shop_board b\r\n\t\t\tLEFT JOIN sc_users as u ON u.u_id=b.userid\r\n\t\tWHERE {$cnd} {$order} limit " . $this->page->getBegin() . "," . $this->page->per;
     $this->rs = $ST->select($queryStr);
     $this->display(array(), dirname(__FILE__) . '/board_list.tpl.php');
 }
Exemplo n.º 9
0
 function actDefault()
 {
     global $ST;
     parent::refresh();
     $this->updateParams();
     $queryStr = "SELECT count(*) AS c FROM sc_news WHERE type='" . $this->getType() . "'";
     $rs = $ST->select($queryStr);
     if ($rs->next()) {
         $this->page->all = $rs->getInt("c");
     }
     $order = "ORDER BY date desc,id DESC, position DESC";
     if ($this->type == 'article') {
         $order = "ORDER BY position DESC, view DESC";
     }
     $queryStr = "SELECT * FROM sc_news WHERE type='" . $this->getType() . "' {$order} limit " . $this->page->getBegin() . "," . $this->page->per;
     $this->rs = $ST->select($queryStr);
     $this->display(array(), dirname(__FILE__) . '/news_list.tpl.php');
 }
Exemplo n.º 10
0
 function actDefault()
 {
     global $ST;
     parent::refresh();
     $cond = "type='{$this->getType()}'";
     if ($cat = $this->getURIIntVal('category')) {
         $cond .= " AND cat={$cat}";
     }
     if ($label = $this->getURIIntVal('label')) {
         $cond .= " AND EXISTS (SELECT gallery_id FROM sc_gallery_label WHERE gallery_id=g.id AND label_id={$label})";
     }
     $q = "SELECT count(*) AS c FROM sc_gallery g WHERE {$cond}";
     $rs = $ST->select($q);
     if ($rs->next()) {
         $this->page->all = $rs->getInt("c");
     }
     $order = 'ORDER BY ';
     $ord = $this->getURIVal('ord') != 'asc' ? 'asc' : 'desc';
     if (in_array($this->getURIVal('sort'), array('name', 'id', 'sort', 'sort_main', 'cat', 'img', 'date'))) {
         $order .= $this->getURIVal('sort') . ' ' . $ord;
     } else {
         $order .= 'id DESC';
     }
     //		$order="ORDER BY sort DESC";
     $q = "SELECT g.*,c.value_desc AS cat_desc FROM sc_gallery g\r\n\t\tLEFT JOIN (SELECT field_value,value_desc FROM sc_enum where field_name='gal_{$this->getType()}_cat') AS c ON c.field_value=g.cat\r\n\t\t\r\n\t\tWHERE {$cond} {$order} limit " . $this->page->getBegin() . "," . $this->page->per;
     $this->rs = $ST->select($q);
     $ids = array();
     while ($this->rs->next()) {
         $ids[] = $this->rs->getInt('id');
     }
     $this->rs->reset();
     $labels = array();
     if ($ids) {
         $rs = $ST->select("SELECT * FROM sc_gallery_label WHERE gallery_id IN (" . implode(',', $ids) . ")");
         while ($rs->next()) {
             if (empty($labels[$rs->get('gallery_id')])) {
                 $labels[$rs->get('gallery_id')] = array();
             }
             $labels[$rs->get('gallery_id')][] = $rs->get('label_id');
         }
     }
     $data = array('cat_list' => $this->enum("gal_{$this->getType()}_cat"), 'label_list' => $this->enum("gal_{$this->getType()}_label"), 'labels' => $labels);
     $this->display($data, dirname(__FILE__) . '/gallery_list.tpl.php');
 }
Exemplo n.º 11
0
 function actSubscribe()
 {
     $page = new Page($this->getPages());
     parent::refresh();
     $cond = " WHERE 1=1 ";
     $query = "SELECT count(*) AS c FROM sc_subscribe " . $cond;
     $rs = DB::select($query);
     if ($rs->next()) {
         $page->all = $rs->getInt('c');
     }
     $order = 'ORDER BY ';
     $ord = $this->getURIVal('ord') != 'asc' ? 'asc' : 'desc';
     if (in_array($this->getURIVal('sort'), array('login', 'mail'))) {
         $order .= $this->getURIVal('sort') . ' ' . $ord;
     } else {
         $order .= " mail";
     }
     $data = array();
     $queryStr = "SELECT s.*,u.login FROM sc_subscribe s\r\n\t\tLEFT JOIN sc_users u ON s.mail=u.mail\r\n\t\t\r\n\t\t{$cond} {$order} LIMIT " . $page->getBegin() . "," . $page->per;
     $data['rs'] = DB::select($queryStr);
     $data['pg'] = $page;
     $this->setPageTitle('Подписка');
     $this->display($data, dirname(__FILE__) . '/subscribe.tpl.php');
 }
Exemplo n.º 12
0
 function actRelation()
 {
     global $ST;
     $data = array('rs' => array());
     parent::refresh();
     $cond = " r.par=p.id AND r.ch=ch.id";
     if ($par = $this->getURIIntVal('relation')) {
         $cond .= " AND par={$par}";
     }
     $query = "SELECT count(*) AS c FROM sc_shop_item AS p,sc_shop_item AS ch,sc_shop_relation r WHERE" . $cond;
     $rs = $ST->select($query);
     if ($rs->next()) {
         $this->page->all = $rs->getInt('c');
     }
     $q = "SELECT p.*,ch.name AS ch_name,ch.id AS ch_id,ch.img AS ch_img,r.type,r.id AS r_id,rt.value_desc AS type_desc FROM sc_shop_item AS p,sc_shop_item AS ch,sc_shop_relation r\r\n\t\t\tLEFT JOIN (SELECT field_value,value_desc FROM sc_enum WHERE field_name='shop_relation') AS rt ON rt.field_value=r.type\r\n\t\tWHERE {$cond} LIMIT {$this->page->getBegin()},{$this->page->per}";
     $rs = $ST->select($q);
     while ($rs->next()) {
         $data['rs'][] = $rs->getRow();
     }
     $this->setPageTitle('Связанные');
     $this->display($data, dirname(__FILE__) . '/admin_relation.tpl.php');
 }
Exemplo n.º 13
0
 function actFix()
 {
     global $ST, $get;
     parent::refresh();
     $cond = "AND type='fix'";
     $queryStr = "SELECT count(*) AS c FROM sc_feedback WHERE 1=1 {$cond}";
     $rs = $ST->select($queryStr);
     if ($rs->next()) {
         $this->page->all = $rs->getInt("c");
     }
     $order = "ORDER BY id DESC";
     $queryStr = "SELECT * FROM sc_feedback WHERE 1=1 {$cond}  {$order} LIMIT " . $this->page->getBegin() . "," . $this->page->per . "";
     $this->rs = $ST->select($queryStr);
     $this->display(array(), dirname(__FILE__) . '/feedback_fix_list.tpl.php');
 }
Exemplo n.º 14
0
 function actPlace()
 {
     global $ST;
     parent::refresh();
     $q = "SELECT count(*) AS c FROM sc_advertising_place";
     $rs = $ST->execute($q);
     if ($rs->next()) {
         $this->page->all = $rs->getInt('c');
     }
     $q = "select * from sc_advertising_place LIMIT " . $this->page->getBegin() . "," . $this->page->per;
     $data['rs'] = $ST->execute($q);
     $this->setPageTitle('Места');
     $this->display($data, dirname(__FILE__) . '/adv_place.tpl.php');
 }