Example #1
0
 public function addCid()
 {
     if ($this->cid) {
         return $this->cid;
     }
     $category = new Models\Category();
     $categories = $category->find(array("order" => "id DESC", "limit" => 100));
     if ($categories) {
         $options = array('All Categories');
         foreach ($categories as $categoryitem) {
             $options[$categoryitem->id] = $categoryitem->categoryName;
         }
         $element = new Select('cid', $options);
     }
     $this->add($element);
     return $this->cid = $element;
 }
Example #2
0
 public function getParents()
 {
     if ($this->parents) {
         return $this->parents;
     }
     $category = new Models\Category();
     $categories = $category->find(array("limit" => 100));
     $category = $this->getModel();
     if ($category->parents) {
         $values = array();
         foreach ($category->parents as $_cate) {
             $values[] = $_cate->id;
         }
         foreach ($categories as $key => $item) {
             $check = new Check('parents[]', array('value' => $item->id));
             if (in_array($item->id, $values)) {
                 $check->setDefault($item->id);
             }
             $check->setLabel($item->categoryName);
             $this->parents[] = $check;
         }
     }
     return $this->parents;
 }