예제 #1
0
 public function types()
 {
     $types = array();
     foreach (Zuha::enum('CONTACT_DETAIL') as $type) {
         $types[Inflector::underscore($type)] = $type;
     }
     return array_merge(array('email' => 'Email'), $types);
 }
예제 #2
0
파일: Contact.php 프로젝트: ajayphp/Zuha
 /**
  * Ratings for contacts
  *
  * @return array
  */
 public function ratings()
 {
     $ratings = array();
     foreach (Zuha::enum('CONTACT_RATING') as $rating) {
         $ratings[Inflector::underscore($rating)] = $rating;
     }
     return array_merge(array('hot' => 'Hot', 'warm' => 'Warm', 'cold' => 'Cold'), $ratings);
 }
예제 #3
0
파일: Webpage.php 프로젝트: ajayphp/Zuha
 /**
  * Types function
  * An array of options for select inputs
  * 
  * @return array
  */
 public function types($name = null)
 {
     foreach (Zuha::enum('WEBPAGES_PAGE_TYPE') as $type) {
         $types[Inflector::underscore($type)] = $type;
     }
     $this->types = Set::merge($this->types, $types);
     if (!empty($name)) {
         return $this->types[$name];
     } else {
         return $this->types;
     }
 }
예제 #4
0
 /**
  * Edit method
  * 
  * @param uuid $id
  */
 public function edit($id = null)
 {
     if ($this->request->is('post') || $this->request->is('put')) {
         if ($this->Setting->add($this->request->data)) {
             $this->Session->setFlash(__('The Setting has been saved', true), 'flash_success');
             $this->redirect($this->referer());
         } else {
             $this->Session->setFlash(__('The Setting could not be saved. Please, try again.', true), 'flash_warning');
         }
     }
     if (!$id && empty($this->request->data) && empty($this->request->params['named'])) {
         $this->Session->setFlash(__('Invalid Setting', true), 'flash_danger');
         $this->redirect(array('action' => 'index'));
     }
     if (!empty($this->request->params['named'])) {
         $this->request->data = $this->Setting->find('first', array('conditions' => array('type_id' => Zuha::enum(null, $this->request->params['named']['type']), 'name' => $this->request->params['named']['name'])));
         $this->set('typeId', Zuha::enum(null, $this->request->params['named']['type']));
         $this->request->data['Setting']['name'] = $this->request->params['named']['name'];
         $this->request->data['Setting']['description'] = $this->Setting->getDescription($this->request->params['named']['type'], $this->request->params['named']['name']);
     }
     if (empty($this->request->data)) {
         $this->request->data = $this->Setting->read(null, $id);
         $this->request->data['Setting']['description'] = $this->Setting->getDescription($this->request->data['Setting']['type'], $this->request->data['Setting']['name']);
     }
     $types = $this->Setting->types();
     $this->set(compact('types'));
     $this->layout = 'default';
 }