function parent_link($categ_id, $categ_see) { global $charset; global $base_path; global $thesaurus_categories_show_empty_categ; if ($categ_see) { $categ = $categ_see; } else { $categ = $categ_id; } $tcateg = new category($categ); if ($thesaurus_categories_show_empty_categ) { $visible = true; } else { $visible = false; } if ($_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["SEARCH_TYPE"] != "term_search" && $_SESSION["CURRENT"]) { $no_rec_history = 1; } else { $no_rec_history = 0; } if ($tcateg->has_notices()) { $link = "<a href='" . $base_path . "/catalog.php?categ=search&mode=1&aut_id={$categ}&etat=aut_search&aut_type=categ&no_rec_history={$no_rec_history}' target=_top><img src='{$base_path}/images/search.gif' border=0 align='absmiddle'></a>"; $visible = true; } $r = array("VISIBLE" => $visible, "LINK" => $link); return $r; }
function categoryList() { $page = new page(); $categ = new category(); $get_list = $categ->getAllList(); $page->printCategories($get_list); }
/** * Show the form for creating a new resource. * * @return Response */ public function create() { $cat = new category(); $cat->category = \Input::get('categoryname'); $cat->save(); return \Redirect::route('catesite')->with('alert', 'Category created successfully!'); }
function list_all() { $c = new category(); $all = $c->get_all_categories(); foreach ($all as $cc) { echo $cc->get_cname() . "<BR/>"; } }
/** * Saves an category into the database. * * @param \GamyGoody\Domain\category $category The category to save */ public function save(category $category) { $categoryData = array('cat_title' => $category->getTitle()); if ($category->getId()) { // The category has already been saved : update it $this->getDb()->update('category', $categoryData, array('cat_id' => $category->getId())); } else { // The category has never been saved : insert it $this->getDb()->insert('category', $categoryData); // Get the id of the newly created category and set it on the entity. $id = $this->getDb()->lastInsertId(); $category->setId($id); } }
public function getAllCategories() { $aCategories = array(); $oConnection = new connection(); $sSQL = "SELECT TypeID\n\t\tFROM tbproducttype"; $oResult = $oConnection->query($sSQL); while ($aRow = $oConnection->fetch_array($oResult)) { $oCategory = new category(); $oCategory->load($aRow["TypeID"]); $aCategories[] = $oCategory; } $oConnection->close_connection(); return $aCategories; }
function categoryEdit() { $page = new page(); $categ = new category(); if (isset($_GET['cid']) and $_GET['cid'] != 0) { $id = $_GET['cid']; } else { $id = 0; } $editthis = $categ->get($id); $msg = $page->processCategory(); $get_all_categories = $categ->getAlltree($editthis['par_id']); $page->printCategoryForm($get_all_categories, $editthis['name'], $id, $msg); }
function show_action() { $this->view->page=front::get('page')?front::get('page'):1; $this->pagesize=config::get('list_pagesize'); $limit=(($this->view->page-1)*$this->pagesize).','.$this->pagesize; $special=new special(); $this->view->special=$special->getrow('spid='.front::get('spid')); $this->view->archive['title'] = $this->view->special['title']; $this->view->pages=true; $archive=new archive(); $archives=$archive->getrows('spid='.front::get('spid'),$limit); foreach($archives as $order=>$arc) { $archives[$order]['url']=archive::url($arc); $archives[$order]['catname']=category::name($arc['catid']); $archives[$order]['caturl']=category::url($arc['catid']); $archives[$order]['adddate']= sdate($arc['adddate']); $archives[$order]['stitle']= strip_tags($arc['title']); } $this->view->archives=$archives; $this->view->record_count=$archive->rec_count('spid='.front::get('spid')); front::$record_count=$this->view->record_count; $this->view->spid=front::get('spid'); if (front::get('t') == 'wap') { $this->out('wap/special_show.html'); return; } }
public static function getInstance() { if (is_null(category::$instance)) { category::$instance = new category(); } return category::$instance; }
static function select($name,$value,$data,$option=null) { $select="<select id=\"$name\" name=\"$name\" $option>"; if (!isset($data[0]) &&@$data[0] != null) { $select.="<option value=\"0\">请选择...</option>"; } if (@$data[0] == null ||(isset($data[0]) &&!$data[0])) unset($data[0]); if($_GET['table'] == 'category'){ $category = category::getInstance(); $subids = $category->sons($_GET['id']); } if($_GET['table'] == 'type'){ $category = type::getInstance(); $subids = $category->sons($_GET['id']); } foreach ($data as $k=>$d) { $select .= "<option value=\"$k\""; if($k == $value){ $select .= ' selected '; }else if(isset($_GET['id']) && ($_GET['table'] == 'category' || $_GET['table'] == 'type') && !preg_match('/htmlrule/is', $name)){ if($_GET['id'] == $k || in_array($k,$subids)){ $select .= ' disabled '; } } $select .= ">$d</option>"; //$select.="<option value=\"$k\" ".($k == $value ?'selected': '').">$d</option>"; } $select.="</select>"; return $select; }
function parent_link($categ_id, $categ_see) { global $charset; global $base_path; global $opac_show_empty_categ; global $css; global $msg; if ($categ_see) { $categ = $categ_see; } else { $categ = $categ_id; } //$tcateg = new category($categ); if ($opac_show_empty_categ) { $visible = true; } else { $visible = false; } if (category::has_notices($categ)) { $link = "<a href='#' onClick=\"parent.parent.document.term_search_form.action='" . $base_path . "/index.php?lvl=categ_see&id={$categ}&rec_history=1'; parent.parent.document.term_search_form.submit(); return false;\" title='" . $msg["categ_see_alt"] . "'><img src='./images/search.gif' border=0 align='absmiddle'></a>"; $visible = true; } $r = array("VISIBLE" => $visible, "LINK" => $link); return $r; }
function upload_thumb_action() { $res=array(); $uploads=array(); if (is_array($_FILES)) { $upload=new upload(); foreach ($_FILES as $name=>$file) { if (!$file['name'] ||!preg_match('/\.(jpg|gif|png|bmp)$/',$file['name'])) { continue; } $uploads[$name]=$upload->run($file); if (empty($uploads[$name])) { $res['error']=$name.lang('上传失败!'); break; } $res[$name]['name']=$uploads[$name]; $path=$upload->save_path; chmod($path,0644); $thumb=new thumb(); $thumb->set($path,'file'); $catid=get('catid'); $type=get('type'); if ($catid) $thumb->create($path,category::getwidthofthumb($catid),category::getheightofthumb($catid)); else $thumb->create($path,config::get('thumb_width'),config::get('thumb_height')); $_name=str_replace('_upload','',$name); $res[$name]['code']=" document.form1.$_name.value=data[key].name; image_preview('$_name',data[key].name); "; } } echo json::encode($res); }
public function Index() { $nva = M('category')->select(); $cate = category::zifenleis($nva); $this->assign('cate', $cate); S('index', $cate, 10); $this->display('Widget:Cate'); }
function ctsitemap_action(){ $category = category::getInstance(); $category->sitemap(); front::flash('生成网站地图成功'); front::redirect(front::$from); /*echo "<script>alert('生成网站地图成功!');window.close();</script>"; exit;*/ }
function categories_list($data = '') { $output = ' <table bgcolor="' . COLOR_TABLE_GENERAL . '"> '; $query = "SELECT * FROM `categories` WHERE `deleted`='0' ORDER BY id ASC"; $res = common_query($query, __FILE__, __LINE__); if (!$res) { return ''; } $i = 0; while ($arr = mysql_fetch_array($res)) { $i++; $catid = $arr['id']; $cat = new category($catid); $name = ucfirst($cat->name($_SESSION['language'])); $backcommand = "order_create1"; $bgcolor = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'categories', 'htmlcolor', $catid); $link = 'orders.php?command=dish_list&data[category]=' . $catid; if (isset($data['quantity']) && $data['quantity']) { $link .= '&data[quantity]=' . $data['quantity']; } if (isset($data['priority']) && $data['priority']) { $link .= '&data[priority]=' . $data['priority']; } if ($i % 2) { $output .= ' <tr>'; } $output .= ' <td bgcolor="' . $bgcolor . '" onclick="redir(\'' . $link . '\');return(false);"> <a href="' . $link . '"> <strong>' . $name . '</strong> </a> </td>'; if (($i + 1) % 2) { $output .= ' </tr>'; } } $output .= ' </tbody> </table>'; return $output; }
/** * Liefert ein array aller Kategorien, auf welche die angegebene Gruppe zugreifen darf * @param int $groupId * @return array */ public function getCategoriesByGroup($groupId) { $where = "groups = ? OR groups " . $this->dbcon->dbLike() . " ? OR groups " . $this->dbcon->dbLike() . " ? OR groups " . $this->dbcon->dbLike() . " ?"; $valueParams = array(); $valueParams[] = "{$groupId}"; $valueParams[] = "%;{$groupId};%"; $valueParams[] = "{$groupId};%"; $valueParams[] = "%;{$groupId}"; $list = $this->dbcon->fetch($this->dbcon->select($this->table, '*', $where, $valueParams), true); $res = array(); foreach ($list as $listItem) { $object = new category(); if ($object->createFromDbObject($listItem)) { $res[$object->getId()] = $object; } } return $res; }
public function __construct() { parent::__construct(); $this->set_table(S_DB_PREFIX . 'cat_art'); $this->set_where("cat_lang = '" . S_LANG . "'"); $this->set_order('cat_top'); $this->set_order('cat_index'); $this->set_order('cat_id', 'asc'); }
public function __construct() { $servername = "localhost"; $username = "******"; $password = "******"; $dbname = "ecommerce"; if (is_null(self::$conn)) { self::$conn = mysqli_connect('localhost', 'root', 'iti', 'ecommerce'); } }
function __construct($appid = null) { $this->cid = (int) $_GET['cid']; $this->appid = iCMS_APP_ARTICLE; $appid && ($this->appid = $appid); $_GET['appid'] && ($this->appid = (int) $_GET['appid']); $this->category_uri .= '&appid=' . $this->appid; $this->category_furi .= '&appid=' . $this->appid; parent::__construct($this->appid); }
public function get_all_categories() { $db = new Database(); if (!$db->connect()) { return array(); } if (!$db->select('categories', 'c_id,c_name')) { return array(); } $result = $db->getResult(); $categories = array(); foreach ($result as $output) { $c = new category(); $c->set_category($output['c_id'], $output['c_name']); array_push($categories, $c); } $db->disconnect(); return $categories; }
function mod() { $clang = Yii::app()->lang; if (!Permission::model()->hasGlobalPermission('panellist', 'update')) { Yii::app()->setFlashMessage($clang->gT("You do not have sufficient rights to access this page."), 'error'); $this->getController()->redirect(array("admin/index")); } $clang = Yii::app()->lang; $action = isset($_POST['action']) ? $_POST['action'] : ''; $aData = array(); $aViewUrls = array(); if (Permission::model()->hasGlobalPermission('', 'create')) { if ($action == "editcategory") { // Project details $category_id = (int) Yii::app()->request->getPost("category_id"); $category_title = flattenText($_POST['category_title'], false, true, 'UTF-8', true); $sort_order = flattenText($_POST['sort_order'], false, true, 'UTF-8', true); $IsActive = flattenText(Yii::app()->request->getPost("IsActive")); $is_Active = 0; if ($IsActive) { $is_Active = 1; } if ($category_title == '') { $aViewUrls['message'] = array('title' => $clang->gT("Failed to add Category"), 'message' => $clang->gT("Category Name is invalid."), 'class' => 'warningheader'); } else { $oUser = category::model()->findByPk($category_id); $oUser->title = $category_title; $oUser->sorder = $sort_order; $oUser->IsActive = $is_Active; $oUser->modified_date = Date('y-m-d h:i:s'); $NewCategory = $oUser->save(); if ($NewCategory) { Yii::app()->setFlashMessage($clang->gT("Profile Category Updated successfully")); $this->getController()->redirect(array("admin/profilecategory/index")); } } } else { if (isset($_POST['category_id'])) { $aData['row'] = 0; $aData['usr_arr'] = array(); // Project detail $category_id = (int) Yii::app()->request->getPost("category_id"); $action = Yii::app()->request->getPost("action"); $sresult = profilecategoryview($category_id); // only use in view_editcompany $aData['category_id'] = $category_id; $aData['mur'] = $sresult; $this->_renderWrappedTemplate('panellist/category', 'editcategory_view', $aData); return; } } } Yii::app()->setFlashMessage(Yii::app()->lang->gT("You do not have sufficient rights to access this page."), 'error'); $this->getController()->redirect(array("admin/profilecategory/index")); }
function __construct($id = -1) { if (self::$conn == Null) { self::$conn = mysqli_connect('localhost', 'root', 'iti', 'babyshop'); } if ($id != -1) { $query = "select * from types where tid={$id} limit 1"; $result = mysqli_query(self::$conn, $query); $cat = mysqli_fetch_assoc($result); $this->id = $cat['tid']; $this->name = $cat['name']; } }
public function search($params) { $query = Category::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $query->andFilterWhere([Category::tableName() . '.status' => '0']); $dataProvider->setSort(['defaultOrder' => ['Id' => SORT_DESC, 'name' => SORT_ASC]]); $query->andFilterWhere([category::tableName() . '.status' => '0']); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['Id' => $this->Id, 'createdBy' => $this->createdBy, 'updatedBy' => $this->updatedBy, 'createdOn' => $this->createdOn, 'updatedOn' => $this->updatedOn, 'status' => $this->status, 'parentId' => $this->parentId, 'is_fg' => $this->is_fg, 'is_event' => $this->is_event]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'ip', $this->ip]); return $dataProvider; }
function parent_link($categ_id, $categ_see) { global $charset; global $base_path; global $thesaurus_categories_show_empty_categ; global $id_empr, $groupID, $unq; if ($categ_see) { $categ = $categ_see; } else { $categ = $categ_id; } $tcateg = new category($categ); if ($thesaurus_categories_show_empty_categ) { $visible = true; } else { $visible = false; } if ($tcateg->has_notices()) { $link = "<a href='" . $base_path . "/circ.php?categ=resa_planning&resa_action=search_resa&mode=1&aut_id={$categ}&etat=aut_search&aut_type=categ&id_empr={$id_empr}&groupID={$groupID}&mode=1&unq={$unq}' target=_top><img src='{$base_path}/images/search.gif' border=0 align='absmiddle'></a>"; $visible = true; } $r = array("VISIBLE" => $visible, "LINK" => $link); return $r; }
public function loadView($view, $data1 = array(), $data2 = array()) { $this->data1 = $data1; if ($this->layout) { ob_start(); $this->category = category::getAll(); $this->type = isset($_GET['type']) ? $_GET['type'] : 'main'; include APP_DIR . "view/" . $this->layout . ".php"; $page = ob_get_clean(); } ob_start(); include APP_DIR . "view/" . $view . ".php"; $page_content = ob_get_clean(); $page = str_replace("[MAIN_CONTENT]", $page_content, $page); echo $page; }
function list_action() { $this->view->page=front::get('page') ?front::get('page') : 1; $this->pagesize=config::get('list_pagesize'); $limit=(($this->view->page -1) * $this->pagesize).','.$this->pagesize; $area=new area(); $where='1'; if (front::get('province_id')) $where.=' and id='.front::get('province_id'); if (front::get('city_id')) $where.=' and id='.front::get('city_id'); if (front::get('section_id')) $where.=' and id='.front::get('section_id'); if (front::get('id')) $where.=' and id='.front::get('id'); $this->view->area=$area->getrow($where); $archive=new archive(); $where='1'; if (front::get('province_id')) $where.=' and province_id='.front::get('province_id'); if (front::get('city_id')) $where.=' and city_id='.front::get('city_id'); if (front::get('section_id')) $where.=' and section_id='.front::get('section_id'); if (front::get('id')) $where.=' and section_id='.front::get('id').' or city_id='.front::get('id').' or province_id='.front::get('id'); $archives=$archive->getrows($where,$limit,'listorder,aid desc'); foreach ($archives as $order=>$arc) { $archives[$order]['url']=archive::url($arc); $archives[$order]['catname']=category::name($arc['catid']); $archives[$order]['caturl']=category::url($arc['catid']); $archives[$order]['adddate']=sdate($arc['adddate']); $archives[$order]['stitle']=strip_tags($arc['title']); } $this->view->pages=true; if(front::get('id')!='') { $this->view->areaid=front::get('id'); }elseif(front::get('province_id')!='') { $this->view->areaid=front::get('province_id'); }elseif(front::get('city_id')!='') { $this->view->areaid=front::get('city_id'); }elseif(front::get('section_id')!='') { $this->view->areaid=front::get('section_id'); } $this->view->archive['title'] = area::name($this->view->areaid); $this->view->archives=$archives; $this->view->record_count=$archive->rec_count($where); front::$record_count=$this->view->record_count; if (front::get('t') == 'wap') { $this->out('wap/area_list.html'); return; } $this->render(); }
/** * Display category tree with input checkboxes for forms * * @param string $form_field form field name * @param array $selected_categories Categories that should be already selected * @param int $columns number of columns to display * @param bool $enable_parents Can parent categoires be select * @param bool $show_hidden Show hidden categories */ public static function form_tree($form_field, array $selected_categories = array(), $columns = 1, $enable_parents = FALSE, $show_hidden = FALSE) { $category_data = self::get_category_tree_data(FALSE, $show_hidden); $html = ''; // Validate columns $columns = (int) $columns; if ($columns == 0) { $columns = 1; } $categories_total = count($category_data); // Format categories for column display. // Column number $this_col = 1; // Maximum number of elements per column $maxper_col = round($categories_total / $columns); // start the first column $html .= "\n" . '<ul class="category-column category-column-' . $this_col . '" id="category-column-' . $this_col . '">' . "\n"; $i = 1; // Element Count foreach ($category_data as $category) { // Display parent category. $html .= "\n\t" . '<li title="' . $category['category_description'] . '">'; $html .= "\n\t\t" . category::display_category_checkbox($category, $selected_categories, $form_field, $enable_parents) . "\n"; // Display child categories. if (count($category['children']) > 0) { $html .= "\t\t<ul>"; foreach ($category['children'] as $child) { $html .= "\n\t\t\t" . '<li title="' . $child['category_description'] . '">' . "\n"; $html .= category::display_category_checkbox($child, $selected_categories, $form_field, $enable_parents); $html .= "\n\t\t\t" . '</li>' . "\r\n"; } $html .= "\t\t" . '</ul>' . "\r\n"; } $html .= "\t</li>\n"; // If this is the last element of a column, close the UL if ($i % $maxper_col == 0 and $i > 0 or $i == $categories_total) { $html .= "</ul>\n"; $this_col++; if ($i < $categories_total) { $html .= '<ul class="category-column category-column-' . $this_col . '" id="category-column-' . $this_col . '">'; } } $i++; } return $html; }
function show_action() { $tagname=urldecode(front::get('tag')); if(preg_match('/union/i',$tagname) || preg_match('/"/i',$tagname) ||preg_match('/\'/i',$tagname)){ exit('非法参数'); } $tag=new tag(); $tag=$tag->getrow('tagname="'.$tagname.'"'); $tagid=$tag['tagid']; $archives=array(); if($tagid) { $arctag=new arctag(); if(front::get('page')) $page=front::get('page'); else $page=1; $this->view->page=$page; $this->view->pagesize=config::get('list_pagesize'); $limit=(($this->view->page-1)*$this->view->pagesize).','.$this->view->pagesize; $this->view->record_count=$arctag->rec_count('tagid='.$tagid); if($this->view->record_count>$this->view->pagesize) $this->view->pages=true; front::$record_count=$this->view->record_count; $arctags=$arctag->getrows('tagid='.$tagid,$limit); $arcids=array(); foreach($arctags as $arctag) { $arcids[]=$arctag['aid']; } $archive=new archive(); $archives=$archive->getrows('aid in ('.implode(',',$arcids).')',null,'aid desc'); foreach($archives as $order=>$arc) { $archives[$order]['url']=archive::url($arc); $archives[$order]['catname']=category::name($arc['catid']); $archives[$order]['caturl']=category::url($arc['catid']); $archives[$order]['adddate']= sdate($arc['adddate']); $archives[$order]['stitle']= strip_tags($arc['title']); } } else echo lang('标签信息不存在'); $this->view->tag=$tagname; $this->view->archive['title'] = $tagname; $this->view->archives=$archives; if (front::get('t') == 'wap') { echo $this->fetch('wap/tag_show.html'); return; } $this->render(); }
/** * Display category tree with input checkboxes. */ public static function tree($categories, array $selected_categories, $form_field, $columns = 1, $enable_parents = FALSE) { $html = ''; // Validate columns $columns = (int) $columns; if ($columns == 0) { $columns = 1; } $categories_total = $categories->count(); // Format categories for column display. $this_col = 1; // column number $maxper_col = round($categories_total / $columns); // Maximum number of elements per column $i = 1; // Element Count foreach ($categories as $category) { // If this is the first element of a column, start a new UL if ($i == 1) { $html .= '<ul id="category-column-' . $this_col . '">'; } // Display parent category. $html .= '<li>'; $html .= category::display_category_checkbox($category, $selected_categories, $form_field, $enable_parents); // Display child categories. if ($category->children->count() > 0) { $html .= '<ul>'; foreach ($category->children as $child) { $html .= '<li>'; $html .= category::display_category_checkbox($child, $selected_categories, $form_field, $enable_parents); } $html .= '</ul>'; } $i++; // If this is the last element of a column, close the UL if ($i > $maxper_col || $i == $categories_total) { $html .= '</ul>'; $i = 1; $this_col++; } } return $html; }
/** * Retrieves a list of models based on the current search/filter conditions. * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions. */ public function search() { // Warning: Please modify the following code to remove attributes that // should not be searched. $criteria = new CDbCriteria(); $criteria->compare('category_id', $this->category_id, true); $criteria->compare('name', $this->name, true); $criteria->compare('parent_id', $this->parent_id, true); $criteria->compare('sort_order', $this->sort_order); $criteria->compare('is_show', $this->is_show); return new CActiveDataProvider(get_class($this), array('criteria' => $criteria)); } public function getChildCount() { $cri = new CDbCriteria(array('condition' => 'parent_id =' . $this->category_id)); $childs = Category::model()->findAll($cri);