public function fetchAll()
 {
     $resultSet = $this->getDbTable()->fetchAll();
     $entries = array();
     foreach ($resultSet as $row) {
         $entry = new PAP_Model_Branch();
         $entry->setId($row->province_id)->setName($row->Name);
         $entries[] = $entry;
     }
     return $entries;
 }
Beispiel #2
0
 public function fetchAll()
 {
     $resultSet = $this->getDbTable()->fetchAll();
     $entries = array();
     foreach ($resultSet as $row) {
         $entry = new PAP_Model_Branch();
         $entry->setId($row->branch_id)->setUser($row->user_id)->setBranchorder($row->branch_order)->setEmail($row->branch_email)->setWebsite($row->branch_website)->setLatitude($row->latitude)->setLongitude($row->longitude)->setName($row->name)->setStreet($row->street)->setNumber($row->number)->setPhone($row->phone)->setLocal($row->local)->setLogo($row->logo)->setProvince($row->province_id)->setCity($row->city_id)->setZipcode($row->zip_code)->setCreated($row->created)->setUpdated($row->updated);
         $entries[] = $entry;
     }
     return $entries;
 }
 private function loadForm(PAP_Model_Branch $branch, $formName)
 {
     $form = $this->view->form;
     $form->name->setValue($branch->getName());
     $form->street->setValue($branch->getStreet());
     $form->number->setValue($branch->getNumber());
     $form->local->setValue($branch->getLocal());
     $form->phone->setValue($branch->getPhone());
     $form->email->setValue($branch->getEmail());
     $form->website->setValue($branch->getWebsite());
     $form->zipcode->setValue($branch->getZipcode());
     $form->lat->setValue($branch->getLatitude())->setAttrib('readonly', 'true')->setAttrib('class', 'readonly');
     $form->latitude->setValue($branch->getLatitude());
     $form->lng->setValue($branch->getLongitude())->setAttrib('readonly', 'true')->setAttrib('class', 'readonly');
     $form->longitude->setValue($branch->getLongitude());
     $form->user->setValue($branch->getUser());
     $form->branch_id->setValue($branch->getId());
     $form->branch_order->setValue($branch->getBranchorder());
     $form->logo->setOptions(array('src' => '/images' . $branch->getLogo()));
     $form->setDefault('province', $branch->getProvince());
     //$combo->setAttrib('onChange', 'loadCities();');
     //$combo = $form->getElement("city");
     //$this->loadCities($combo, $branch->getProvince());
     $form->setDefault('city', $branch->getCity());
     if ($formName = 'update') {
         $form->filebranch->setRequired(false)->setLabel('Imagen del Comercio');
     }
 }
 public function fetchAll($userId = null)
 {
     if (isset($userId)) {
         $select = $this->getDbTable()->select();
         $select->where("user_id = ?", $userId);
         $resultSet = $this->getDbTable()->fetchAll($select);
     } else {
         $resultSet = $this->getDbTable()->fetchAll();
     }
     $entries = array();
     foreach ($resultSet as $row) {
         $entry = new PAP_Model_Branch();
         $entry->setId($row->promotion_id)->setPromoCode($row->promo_code)->setUserId($row->user_id)->setStarts($row->starts)->setEnds($row->ends)->setShortDescription($row->short_description)->setLongDescription($row->long_description)->setPromoValue($row->promo_value)->setValueSince($row->value_since)->setQuantity($row->quantity)->setPromoType($row->type)->setDisplayedText($row->displayed_text)->setAlertType($row->alert_type)->setState($row->state)->setPromoCost($row->promo_cost)->setVisited($row->visited)->setCreated($row->created);
         $entries[] = $entry;
     }
     return $entries;
 }