/**
  *  add view
  *
  *  @access public
  */
 function perform()
 {
     $r =& $this->_getopt(array('basedir=', 'skelfile=', 'template'));
     if (Ethna::isError($r)) {
         return $r;
     }
     list($opt_list, $arg_list) = $r;
     // view_name
     $view_name = array_shift($arg_list);
     if ($view_name == null) {
         return Ethna::raiseError('view name isn\'t set.', 'usage');
     }
     $r =& Ethna_Controller::checkViewName($view_name);
     if (Ethna::isError($r)) {
         return $r;
     }
     // add view
     $ret =& $this->_perform('View', $view_name, $opt_list);
     if (Ethna::isError($ret) || $ret === false) {
         return $ret;
     }
     // add template
     if (isset($opt_list['template'])) {
         $ret =& $this->_perform('Template', $view_name, $opt_list);
         if (Ethna::isError($ret) || $ret === false) {
             return $ret;
         }
     }
     return true;
 }
 /**
  *  add view test
  *
  *  @access public
  */
 function perform()
 {
     $r =& $this->_getopt(array('basedir=', 'skelfile='));
     if (Ethna::isError($r)) {
         return $r;
     }
     list($opt_list, $arg_list) = $r;
     // view_name
     $view_name = array_shift($arg_list);
     if ($view_name == null) {
         return Ethna::raiseError('view name isn\'t set.', 'usage');
     }
     $r =& Ethna_Controller::checkViewName($view_name);
     if (Ethna::isError($r)) {
         return $r;
     }
     $ret =& $this->_perform('ViewTest', $view_name, $opt_list);
     return $ret;
 }
 /**
  *  add template 
  *
  *  @access public
  */
 function perform()
 {
     $r =& $this->_getopt(array('basedir=', 'skelfile='));
     if (Ethna::isError($r)) {
         return $r;
     }
     list($opt_list, $arg_list) = $r;
     // template
     $template = array_shift($arg_list);
     if ($template == null) {
         return Ethna::raiseError('template name isn\'t set.', 'usage');
     }
     $r =& Ethna_Controller::checkViewName($template);
     // XXX: use checkViewName().
     if (Ethna::isError($r)) {
         return $r;
     }
     // add template
     $ret =& $this->_perform('Template', $template, $opt_list);
     return $ret;
 }
Beispiel #4
0
 /**
  *  add view
  *
  *  @access public
  */
 function perform()
 {
     //
     //  '-w[with-unittest]' and '-u[unittestskel]' option
     //  are not intuisive, but I dare to define them because
     //  -t and -s option are reserved by add-[action|view] handle
     //  and Ethna_Getopt cannot interpret two-character option.
     //
     $r = $this->_getopt(array('basedir=', 'skelfile=', 'with-unittest', 'unittestskel=', 'template', 'locale=', 'encoding='));
     if (Ethna::isError($r)) {
         return $r;
     }
     list($opt_list, $arg_list) = $r;
     // view_name
     $view_name = array_shift($arg_list);
     if ($view_name == null) {
         return Ethna::raiseError('view name isn\'t set.', 'usage');
     }
     $r = Ethna_Controller::checkViewName($view_name);
     if (Ethna::isError($r)) {
         return $r;
     }
     // add view(invoke parent class method)
     $ret = $this->_perform('View', $view_name, $opt_list);
     if (Ethna::isError($ret) || $ret === false) {
         return $ret;
     }
     // add template
     if (isset($opt_list['template'])) {
         $ret = $this->_performTemplate($view_name, $opt_list);
         if (Ethna::isError($ret) || $ret === false) {
             return $ret;
         }
     }
     return true;
 }