Пример #1
0
 public static function field()
 {
     $args = func_get_args();
     $type = array_shift($args);
     $label = array_shift($args);
     $data = array_shift($args);
     if (!isset($data['value'])) {
         $data['value'] = isset($data['default']) ? $data['default'] : '';
     }
     $html = new ZtHtml();
     $html->set('label', $label);
     $html->set('data', $data);
     return $html->fetch('fields/' . $type . '.php');
 }
Пример #2
0
 /**
  * Add notice message
  * @param type $message
  * @param type $type
  * @return \ZtAjax
  */
 public function addMessage($message, $header = '', $type = 'info')
 {
     switch ($type) {
         case 'error':
         case 'danger':
         case 'alert':
             $messageType = 'error';
             break;
         case 'warning':
             $messageType = 'warning';
             break;
         case 'success':
         case 'message':
         case '':
             $messageType = 'success';
             break;
         default:
             $messageType = 'info';
             break;
     }
     $html = new ZtHtml();
     $html->set('header', $header);
     $html->set('message', $message);
     $html->set('type', $messageType);
     $html->set('originalType', $type);
     $data = new stdClass();
     $data->message = $html->fetch('Zt://html/message.php');
     $this->add($data, 'message');
     return $this;
 }