function dataAUX($tbl, $page, $cond) { //count query $this->db->select('COUNT(*) as TOTAL', FALSE); $this->db->from($tbl); $this->db->where($cond); $query = $this->db->get(); $rows = $query->result_array(); $totalcount = $rows[0]["TOTAL"]; //page $pageno = 1; $pagesize = 50; if ($page['pageno']) { $pageno = $page['pageno']; } if ($page['pagesize']) { $pagesize = $page['pagesize']; } $totalpage = getTotalPage($totalcount, $pagesize); $result['totalpage'] = $totalpage; $result['pageno'] = $pageno; //query data $this->db->select("DATA_FILENAME,to_char(DATA_DATE,'YYYY-MM-DD HH24:MI:SS') AS DATE_STR,DATA_VERSION,DATA_FILESIZE,DATA_INTERVAL", False); $this->db->from($tbl); $this->db->where($cond); $snumber = getStartNumber($pageno, $pagesize); $this->db->limit($pagesize, $snumber); $query = $this->db->get(); $result['list'] = $query->result_array(); return $result; }
/** * 根据查询条件 获取组件列表 */ public function get_models($page = null, $mtypecond = null, $mnamecond = null, $midcond = null, $orderBy = null, $orderstr = null) { $this->load->helper('ourpage'); $pageno = 1; $pagesize = 20; $order = ''; if ($page['pageno']) { $pageno = $page['pageno']; } $cond = ""; if ($mtypecond) { if ($mtypecond != -1) { $cond .= " and mod.\"MTID\" ='" . $mtypecond . "'"; } } if ($mnamecond) { $cond .= " and mod.\"Name\" like '%" . $mnamecond . "%'"; } if ($midcond) { $cond .= " and mod.\"ID\" = " . $midcond; } if ($orderstr && $orderBy) { $order = " order by mod.\"" . $orderBy . "\" " . $orderstr; } else { $order = " order by mod.ID desc "; } $countsql = "select count(*) from \"T_PPC_Module\" mod where 1=1 " . $cond; // echo $countsql; $querycount = $this->db->query($countsql); $row = $querycount->row_array(); $totalcount = $row["COUNT(*)"]; if ($totalcount > 0) { $totalpage = getTotalPage($totalcount, $pagesize); $snumber = getStartNumber($pageno, $pagesize); $enumber = getEndNumber($pageno, $pagesize); $sql = "select * from (select t.*, rownum rn from ( select * from \"T_PPC_Module\" mod where 1=1 and isview=1 " . $cond . $order . " ) t where rownum <=" . $enumber . ") where rn > " . $snumber; $query = $this->db->query($sql); $result['list'] = $query->result_array(); $result['totalpage'] = $totalpage; $result['totalcount'] = $totalcount; $result['pageno'] = $pageno; } else { $result['list'] = array(); $result['totalpage'] = 0; $result['totalcount'] = 0; $result['pageno'] = 0; } $result['order'] = $orderstr; $result['orderBy'] = $orderBy; return $result; }
public function get_productlines($page = null, $cond = null, $orderBy = null, $orderstr = null) { $this->load->helper('ourpage'); $pageno = 1; $pagesize = 20; if ($page['pageno'] == true) { $pageno = $page['pageno']; } $condstr = ""; if ($cond) { if ($cond['scond'] && $cond['scond'] != '-1') { $condstr .= " and pl.\"SatCode\"='" . $cond['scond'] . "'"; } if ($cond['plname']) { $condstr .= " and pl.\"Alias\" like '%" . $cond['plname'] . "%'"; } if ($cond['devcode'] && $cond['devcode'] != '-1') { $condstr .= " and pl.\"DevCode\"='" . $cond['devcode'] . "'"; } // $condstr .= " and ( mod.\"Caption\"='" . $cond . "' or mod.\"Code\" = '" . $cond . "' )"; } if ($orderstr && $orderBy) { $order = " order by pl.\"" . $orderBy . "\" " . $orderstr; } else { $order = " order by pl.ID desc "; } $countsql = "select count(*) from \"T_PPC_ProductLine\" pl where 1=1 " . $condstr; //echo $countsql; $totalcount = $this->getNumberCount($countsql); if ($totalcount > 0) { $totalpage = getTotalPage($totalcount, $pagesize); $snumber = getStartNumber($pageno, $pagesize); $enumber = getEndNumber($pageno, $pagesize); $query = null; $sql = "select * from (select t.*, rownum rn from (\n select * from \"T_PPC_ProductLine\" pl where 1=1 " . $condstr . $order . " ) t where rownum <=" . $enumber . ")\n where rn > " . $snumber; $querydata = $this->db->query($sql); $result['list'] = $querydata->result_array(); $result['totalpage'] = $totalpage; $result['pageno'] = $pageno; } else { $result['list'] = array(); $result['totalpage'] = 0; $result['pageno'] = 0; } $result['order'] = $orderstr; $result['orderBy'] = $orderBy; return $result; }
public function get_cats($page = null, $cond1 = null, $orderBy = null, $orderstr = null) { $this->load->helper('ourpage'); $pageno = 1; $pagesize = 10; $order = ''; if ($page['pageno'] == true) { $pageno = $page['pageno']; if (!$pageno) { $pageszie = 1; } // print "----".$pagesize; } $cond = ""; if ($cond1) { $cond .= " and cat.\"MTName\" like '%" . $cond1 . "%'"; } if ($orderstr && $orderBy) { $order = " order by cat.\"" . $orderBy . "\" " . $orderstr; } else { $order = " order by cat.id desc "; } $countsql = "select count(*) from \"T_PPC_ModuleType\" cat where 1=1 " . $cond; $query = $this->db->query($countsql); $row = $query->result_array(); $totalcount = $row[0]["COUNT(*)"]; $totalpage = getTotalPage($totalcount, $pagesize); $snumber = getStartNumber($pageno, $pagesize); $enumber = getEndNumber($pageno, $pagesize); $sql = "select * from (select t.*, rownum rn from ( select * from \"T_PPC_ModuleType\" cat where 1=1 " . $cond . $order . " ) t where rownum < =" . $enumber . ") where rn > " . $snumber; //print $sql; $query = $this->db->query($sql); $result['list'] = $query->result_array(); $result['totalpage'] = $totalpage; $result['pageno'] = $pageno; $result['order'] = $orderstr; $result['orderBy'] = $orderBy; return $result; }
$newRes->set('pagetitle', $fullcode); $newRes->set('template', $template); $newRes->set('published', 1); $newRes->set('hidemenu', 1); $newRes->set('parent', $pa_resid); $newRes->set('content_type', 7); // set JSON as content type $newRes->save(); if (!$newRes->isMember('Blogger_resources_group')) { $newRes->joinGroup('Blogger_resources_group'); } if (!$newRes->isMember('Menegers_resource_group')) { $newRes->joinGroup('Menegers_resource_group'); } } $pa_resid = $scriptProperties['pa_resid']; // id ресурса промо-акции $tpl_id = 8; // шаблон Bootstrap.inner.pcodes // Получаем уникальный код акции, хранимый в TV $pa_code = $modx->runSnippet('pdoField', array('id' => $pa_resid, 'field' => 'pa-code')); $new_start_pcode = getStartNumber($pa_resid, $pa_code); $count = 500; while ($count > 0) { $new_start_pcode_str = str_pad($new_start_pcode, 6, '0', STR_PAD_LEFT); addResource($new_start_pcode_str, $pa_resid, $tpl_id); $count--; echo "<br> Код сгенерирован: " . $new_start_pcode_str; $new_start_pcode++; } //return 'Промо коды сгенерированы: ' . $count;
public function error_list($page, $cond, $userId) { $tblName = "BUSINESS_PROCESS_DETAILED_LOG"; $this->load->helper('ourpage'); $pageno = 1; $pagesize = 10; if ($page['pageno']) { $pageno = $page['pageno']; } if ($page['pagesize']) { $pagesize = $page['pagesize']; } //count query $this->db->select('COUNT(*) as TOTAL', FALSE); $this->db->from($tblName); //ÎÀÐÇȨÏÞ $this->db->where("SATELLITE_ID in (select US.SATELLITE_ID from USER_SATELLITE us where US.userid = {$userId})"); $this->db->where("DATA_RESULT != 0"); if ($cond["type"] == "satellite") { $this->db->where('SATELLITE_ID', $cond["value"]); } else { if ($cond["type"] == 'flow_name') { $this->db->where('PROCESS_CAPTION', $cond["value"]); } } if ($cond["startDate"]) { $this->db->where("PROCESS_DATE >= to_date('" . $cond["startDate"] . "','yyyy-MM-dd')"); } if ($cond["endDate"]) { $this->db->where("PROCESS_DATE <= to_date('" . $cond["endDate"] . " 23:59:59','yyyy-MM-dd hh24:mi:ss')"); } $query = $this->db->get(); $row = $query->result_array(); //print_r($row); $totalcount = $row[0]["TOTAL"]; $totalpage = getTotalPage($totalcount, $pagesize); //bulid data $result['totalpage'] = $totalpage; $result['pageno'] = $pageno; $this->db->select("{$tblName}.*,to_char(PROCESS_DATE,'YYYY-MM-DD HH24:MI:SS') as PROCESS_DATE_STR", false); $this->db->from($tblName); //ÎÀÐÇȨÏÞ $this->db->where("SATELLITE_ID in (select US.SATELLITE_ID from USER_SATELLITE us where US.userid = {$userId})"); $this->db->where("DATA_RESULT ! = 0"); if ($cond["type"] == "satellite") { $this->db->where('SATELLITE_ID', $cond["value"]); } else { if ($cond["type"] == 'flow_name') { $this->db->where('PROCESS_CAPTION', $cond["value"]); } } if ($cond["startDate"]) { $this->db->where("PROCESS_DATE >= to_date('" . $cond["startDate"] . "','yyyy-MM-dd')"); } if ($cond["endDate"]) { $this->db->where("PROCESS_DATE <= to_date('" . $cond["endDate"] . " 23:59:59','yyyy-MM-dd hh24:mi:ss')"); } $snumber = getStartNumber($pageno, $pagesize); if ($snumber == 0) { $snumber = 1; } $this->db->limit($pagesize, $snumber); $this->db->order_by("PROCESS_DATE", "desc"); $query = $this->db->get(); //print_r($pagesize); //bulid data $result['list'] = $query->result_array(); return $result; }