Beispiel #1
0
 public function __construct()
 {
     $this->_messages = array();
     $this->_msgData = Wax_Factory::createObject('Wax_Session_Namespace', 'Wax_Messages');
     foreach ($this->_msgData as $message) {
         $this->_messages[] = $message;
     }
 }
Beispiel #2
0
 public function __construct($tagName = null)
 {
     $this->attributes = Wax_Factory::createObject('Wax_Document_Element_Attributes');
     $this->style = Wax_Factory::createObject('Wax_Document_Element_Attributes_Style');
     $this->id = '';
     $this->tagName = $tagName ? $tagName : '';
     $this->className = '';
     $this->_innerHTML = '';
     $this->_childNodes = array();
 }
Beispiel #3
0
 /**
  * @return Wax_Document_Body_Form_Select_OptionGroup
  */
 public static function createOptionGroup($options, $label, $value = null)
 {
     $optionGroup = Wax_Factory::createObject('Wax_Document_Body_Form_Select_OptionGroup', $label);
     settype($value, 'array');
     foreach ($options as $optionValue => $optionLabel) {
         $selected = in_array($optionValue, $value);
         $optionGroup->appendChild(self::createOption($optionValue, $optionLabel, $selected));
     }
     return $optionGroup;
 }
Beispiel #4
0
 /**
  * @return Wax_Document_TextNode
  */
 public static function createTextNode($text, $parent = null)
 {
     $newElement = Wax_Factory::createObject('Wax_Document_TextNode', $text);
     if ($parent instanceof Wax_Document_Element) {
         $parent->appendChild($newElement);
     } elseif (is_string($parent)) {
         $parent = self::getElementById($parent);
         $parent->appendChild($newElement);
     }
     return $newElement;
 }
Beispiel #5
0
 public function __construct($name = null, $type = self::TYPE_NORMAL, $extras = null)
 {
     parent::__construct('table');
     if (!isset($extras['cellpadding'])) {
         $extras['cellpadding'] = 0;
     }
     if (!isset($extras['cellspacing'])) {
         $extras['cellspacing'] = 0;
     }
     $this->_name = $name;
     $this->_type = $type || self::TYPE_NORMAL;
     $this->setId($this->_name);
     $this->setAttributes($extras);
     $this->tHead = Wax_Factory::createObject('Wax_Document_Body_Table_THead');
     $this->tFoot = Wax_Factory::createObject('Wax_Document_Body_Table_TFoot');
     $this->appendChild($this->tHead)->appendChild($this->tFoot);
 }
Beispiel #6
0
 public function __construct($options, $name = null, $value = null, $listsep = null)
 {
     parent::__construct('Div');
     if (empty($listsep)) {
         $listsep = Wax_Document::createTextNode(' ');
     } elseif (is_string($listsep)) {
         $listsep = Wax_Document::createElement($listsep);
     }
     $i = 0;
     foreach ((array) $options as $radioValue => $radioLabel) {
         $radioId = $name . ucfirst($radioValue);
         $radio = Wax_Factory::createObject('Wax_Document_Body_Form_Element_Input_Radio', $name, $radioValue);
         if ($value == $radioValue) {
             $radio->setAttribute('checked', 'checked');
         }
         $radio->setId($radioId);
         $this->appendChild($radio)->appendChild(Wax_Document::createTextNode(' '))->appendChild(Wax_Document::createElement('label')->innerHTML($radioLabel)->setAttribute('for', $radioId))->appendChild($listsep);
         $i++;
     }
 }
Beispiel #7
0
 /**
  * @return Wax_Db_Query_Select
  */
 public static function select()
 {
     return Wax_Factory::createObject('Wax_Db_Query_Select');
 }
Beispiel #8
0
 /**
  * @return Standard8_TitleNav
  */
 public function createTitleNav($title, $nav = null)
 {
     return Wax_Factory::createObject(array('Standard8', 'Standard8_TitleNav'), $title, $nav);
 }
Beispiel #9
0
if (strncmp($requestURI, '/@@/', 4) == 0) {
    Wax_Factory::includeClass('Wax_Controller_Icon');
    Wax_Controller_Icon::getInstance()->setIconPath(ICON_PATH)->dispatch();
} elseif (strncmp($requestURI, '/@JavaScript/', 5) == 0) {
    Wax_Factory::includeClass('Wax_Controller_JavaScript');
    Wax_Controller_JavaScript::getInstance()->setModulesPath(MODULES_PATH)->setLibraryPath(LIBRARY_PATH)->dispatch();
} elseif (strncmp($requestURI, '/~', 2) == 0) {
    Wax_Factory::includeClass('Wax_Controller_Profile');
    Wax_Controller_Profile::getInstance()->setProfileClass(array('Standard8', 'Personas_Perfil'))->dispatch();
} else {
    Wax_Factory::includeClass('Wax_Controller_Front');
    Wax_Factory::includeClass('Wax_Session');
    Wax_Factory::includeClass('Wax_Db');
    Wax_Factory::includeClass('Standard8_Config');
    Wax_Factory::includeClass('Standard8_Session');
    Wax_Factory::includeClass('Standard8_Uri');
    Wax_Session::start();
    Wax_Locale::setLocalePath(LOCALE_PATH);
    Wax_Locale::__init();
    Wax_Db::open($dbConfig);
    Standard8_Session::start();
    Standard8_Config::getInstance();
    Wax_Document::$head->importStyle('/stylesheets/screen.css');
    Wax_Document::$head->importStyle('/stylesheets/ie.css', Wax_Document_Head_Style::MEDIA_SCREEN, 'IE 6');
    Wax_Document::$head->importJavaScript('/javascripts/jquery.js');
    Wax_Document::$head->importJavaScript('/javascripts/wax.js');
    $SID = Standard8_Session::getSID();
    $frontController = Wax_Controller_Front::getInstance()->setBinaryPath(MODULES_PATH)->setBase(array('Standard8', 'Standard8'))->setDefault(array('Standard8', 'Modules'));
    if (empty($SID)) {
        $currentClass = $frontController->getClass();
        $supportClasses = array('Personas_Invitacion', 'Personas_Recuperar', 'Personas_Ingresar');
Beispiel #10
0
 protected function instanceClass($classBase, $className, $parameters = array())
 {
     $moduleName = $this->_moduleDefault;
     $classNameParameters = array();
     if (is_array($className)) {
         $moduleName = ucfirst(array_shift($className));
         $className = ucfirst(array_shift($className));
         # $classParam = array($moduleName, $className);
     } else {
         $className = ucfirst($className);
         # $classParam = $className;
     }
     if ($classBase) {
         array_unshift($parameters, $classBase);
     }
     # $className = implode('_', array_map('ucfirst', explode('_', $className) ) );
     do {
         $filePath = implode('/', array_map('ucfirst', explode('_', $className)));
         # $filePath = str_replace('_', '/', $className);
         $fileName = $this->_binaryPath . '' . $moduleName . '/' . $filePath . '.php';
         $fileExists = file_exists($fileName);
         if (!$fileExists) {
             $classNamePieces = explode('_', $className);
             # if ( sizeof($classNamePieces) == 0 )
             #     return false;
             if (sizeof($classNamePieces) > 0) {
                 $classNamePiecesLast = array_pop($classNamePieces);
                 if (strlen($classNamePiecesLast) == 0) {
                     return false;
                 }
             } else {
                 return false;
             }
             array_unshift($classNameParameters, $classNamePiecesLast);
             $className = implode('_', array_map('ucfirst', $classNamePieces));
             # $className = implode('_', $classNamePieces );
         }
     } while (!$fileExists);
     $className = implode('_', array_map('ucfirst', explode('_', $className)));
     if (sizeof($classNameParameters) > 0) {
         $parameters = array_merge($parameters, $classNameParameters);
     }
     $classParam = array($moduleName, $className);
     try {
         $classInstance = Wax_Factory::createObject($classParam, $parameters);
     } catch (Wax_Exception $e) {
         return false;
     }
     $classMethods = get_class_methods($classInstance);
     if (1) {
         switch (true) {
             case Wax_Request::getInstance()->isPost():
                 $result = false;
                 if (in_array('__onSubmit', $classMethods, true)) {
                     $args = array();
                     $classMethod = new ReflectionMethod($className, '__onSubmit');
                     $classMethodParams = $classMethod->getParameters();
                     foreach ($classMethodParams as $parameter) {
                         if ($parameter->isDefaultValueAvailable()) {
                             $args[] = Wax_Request::getInstance()->getPost($parameter->getName(), $parameter->getDefaultValue());
                         } else {
                             $args[] = Wax_Request::getInstance()->getPost($parameter->getName());
                         }
                     }
                     $result = $classMethod->invokeArgs($classInstance, $args);
                 }
                 if (Wax_Response::getInstance()->canSendHeaders()) {
                     if (is_array($result)) {
                         $resultClass = $result[1];
                         $result = $result[0];
                         if (is_array($resultClass)) {
                             $resultUri = Standard8_Uri::createUri($resultClass[0], $resultClass[1]);
                         } else {
                             $resultUri = Standard8_Uri::createUri($resultClass);
                         }
                         Wax_Response::getInstance()->setRedirect($resultUri);
                     } else {
                         Wax_Response::getInstance()->setRedirect(Wax_Request::getInstance()->getRequestUri());
                     }
                 }
                 break;
             case Wax_Request::getInstance()->isXmlHttpRequest() && in_array('__onXmlHttpRequest', $classMethods, true):
                 $args = array();
                 $classMethod = new ReflectionMethod($className, '__onXmlHttpRequest');
                 $classMethodParams = $classMethod->getParameters();
                 foreach ($classMethodParams as $parameter) {
                     if ($parameter->isDefaultValueAvailable()) {
                         $args[] = Wax_Request::getInstance()->get($parameter->getName(), $parameter->getDefaultValue());
                     } else {
                         $args[] = Wax_Request::getInstance()->get($parameter->getName());
                     }
                 }
                 Wax_Response::getInstance()->appendBody($classMethod->invokeArgs($classInstance, $args), $className . '_XmlHttpRequest')->sendResponse();
                 return true;
                 break;
             default:
                 break;
         }
         return $classInstance;
     }
     return false;
 }
Beispiel #11
0
 /**
  * @return Wax_Document_Body_Form
  */
 public function appendSelect($options, $name, $label = null, $selected = null, $required = false, $inline = false, $extras = null)
 {
     #
     # if ( $required )
     #    $extras['class'] = ( isset($extras['class']) ) ? $extras['class'] . ' required' : 'required';
     #
     # if ( !( $extras['title'] ) )
     #     $extras['title'] = $label;
     #
     $child = Wax_Factory::createObject('Wax_Document_Body_Form_Select', $options, $name, $selected)->setAttributes($extras);
     if ($required) {
         $child->addClass('required');
     }
     // ->setAttribute('alt', '{required:true}');
     if (!$extras['title']) {
         $child->setAttribute('title', $label);
     }
     return $this->appendElement($name, $label, $child, $inline);
 }
Beispiel #12
0
 /**
  * @return Wax_Document_Head
  */
 public function importStyle($fileName, $media = Wax_Document_Head_Style::MEDIA_SCREEN, $condition = null)
 {
     if (substr($fileName, strlen(self::EXT_STYLESHEET) * -1) != self::EXT_STYLESHEET) {
         $fileName .= self::EXT_STYLESHEET;
     }
     # if ( strncmp($fileName, '../public', strlen('../public')) )
     #     $fileNameServer = '../public' . $fileName;
     # else
     #     $fileNameServer = $fileName;
     # if ( file_exists($fileNameServer) )
     if (1) {
         $styleMedia = $media;
         if (!empty($condition)) {
             $media = 'condition:' . $media;
         }
         if (!isset($this->_style[$media])) {
             $this->_style[$media] = Wax_Factory::createObject('Wax_Document_Head_Style', $styleMedia);
             if (!empty($condition)) {
                 $condObject = Wax_Factory::createObject('Wax_Document_Head_Condition', $condition, $this->_style[$media]);
                 $this->appendChild($condObject);
             } else {
                 $this->appendChild($this->_style[$media]);
             }
         }
         $this->_style[$media]->import($fileName);
     }
     return $this;
 }
Beispiel #13
0
 /**
  * @return Wax_Document_Comment
  */
 public static function createComment($comment)
 {
     return Wax_Factory::createObject('Wax_Document_Comment', $comment);
 }