コード例 #1
0
ファイル: Location.php プロジェクト: joksnet/php-old
 /**
  * @return Standard8_Location
  */
 public function appendLocation($label, $uri, $inside = false, $icon = null)
 {
     $li = Wax_Document::createElement('li');
     $a = Wax_Document::createElement('a', $li)->setAttribute('href', $uri);
     if (!empty($icon)) {
         $li->appendClassName('image');
         $a->appendChild(Wax_Document::createElement('em')->appendChild(Wax_Document::$body->createImage(Standard8_Uri::createUriIcon($icon), $label))->appendChild(Wax_Document::createTextNode($label)));
     } else {
         $a->appendChild(Wax_Document::createElement('em')->innerHTML($label));
     }
     if (!is_null($this->_lastLi) && $inside) {
         $this->_lastLi->appendClassName('drop');
         $ul = $this->_lastLi->getElementsByTagName('ul');
         if (sizeof($ul) == 0) {
             $ul = Wax_Document::createElement('ul', $this->_lastLi)->appendChild($li);
         } elseif (sizeof($ul) == 1) {
             $ul = array_shift($ul);
             if ($ul instanceof Wax_Document_Element) {
                 $ul->appendChild($li);
             }
         }
     } else {
         $this->_lastLi = $li;
         $this->appendChild($li);
     }
     return $this;
 }
コード例 #2
0
ファイル: Element.php プロジェクト: joksnet/php-old
 public final function setId($id)
 {
     if (Wax_Document::getElementById($id)) {
         throw new Wax_Document_Body_Element_Exception("Id \"{$id}\" already exists");
     }
     parent::setId($id);
 }
コード例 #3
0
ファイル: Document.php プロジェクト: joksnet/php-old
 public static function __init()
 {
     self::$docType = Wax_Factory::createObject('Wax_Document_DocType');
     self::$documentElement = self::createElement('html')->setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
     self::$head = Wax_Factory::createObject('Wax_Document_Head');
     self::$body = Wax_Factory::createObject('Wax_Document_Body');
     self::$documentElement->appendChild(self::$head);
     self::$documentElement->appendChild(self::$body);
 }
コード例 #4
0
ファイル: Head.php プロジェクト: joksnet/php-old
 public function __construct()
 {
     parent::__construct('Head');
     $this->_title = Wax_Document::createElement('title', $this)->setTagType(Wax_Document_Element::TAG_OPEN);
     $this->_meta = array();
     $this->_script = array();
     $this->_style = array();
     $this->appendMeta($this->_contentType . ';' . ' charset=' . $this->_charset, null, 'Content-Type');
 }
コード例 #5
0
ファイル: Sidebar.php プロジェクト: joksnet/php-old
 /**
  * @return Standard8_Sidebar
  */
 public function appendLine($label = null)
 {
     $li = Wax_Document::createElement('li')->setClassName('line');
     if (!empty($label)) {
         $li->appendChild(Wax_Document::createElement('span')->innerHTML($label));
     } else {
         $li->appendChild(Wax_Document::createComment(''));
     }
     $this->_pagesnav->appendChild($li);
 }
コード例 #6
0
ファイル: THead.php プロジェクト: joksnet/php-old
 /**
  * @return Wax_Document_Body_Table_THead
  */
 public function appendColumn($name, $label, $type = null, $protected = false, $size = null, $extras = null)
 {
     $nameColumn = $name . 'Column';
     if (!is_null($size)) {
         if (is_numeric($size)) {
             $size .= 'px';
         }
     }
     $this->_data[$name] = array('type' => $type, 'protected' => $protected);
     $this->_rows[$this->_index]->appendChild(Wax_Document::createElement('th')->innerHTML($label)->setId($nameColumn)->setAttribute('scope', 'col')->setAttributes($extras)->setStyle('width', $size));
     return $this;
 }
コード例 #7
0
ファイル: TitleNav.php プロジェクト: joksnet/php-old
 /**
  * @return Standard8_TitleNav
  */
 public function appendNav($label, $uri, $default = false, $icon = null)
 {
     if (is_null($this->_ul)) {
         $this->_ul = Wax_Document::createElement('ul', $this);
     }
     if (is_string($icon)) {
         $icon = Wax_Document::$body->createImage(Standard8_Uri::createUriIcon($icon), $label);
     }
     settype($default, 'boolean');
     if ($default) {
         Wax_Document::createElement('li', $this->_ul)->setClassName('active')->appendChild(Wax_Document::createElement('span')->appendChild($icon)->appendChild(Wax_Document::createTextNode($label)));
     } else {
         Wax_Document::createElement('li', $this->_ul)->appendChild(Wax_Document::createElement('a')->setAttribute('href', $uri)->appendChild(Wax_Document::createElement('span')->appendChild($icon)->appendChild(Wax_Document::createTextNode($label))));
     }
     return $this;
 }
コード例 #8
0
ファイル: Standard8.php プロジェクト: joksnet/php-old
 public function __construct()
 {
     parent::__construct('div');
     $this->_locationBar = Wax_Factory::createObject(array('Standard8', 'Standard8_Location'));
     if (Standard8_Session::getSID()) {
         $username = Standard8_Session::getData('usuario');
         $this->_locationLogout = Wax_Document::createElement('div')->setClassName('logout')->appendChild(Wax_Document::createElement('a')->appendChild(Wax_Document::$body->createImage(Standard8_Uri::createUriIcon('user'), $username))->appendChild(Wax_Document::createTextNode($username))->setAttribute('href', Standard8_Uri::createUriProfile($username)))->appendChild(Wax_Document::createTextNode(' - '))->appendChild(Wax_Document::createElement('a')->setAttribute('href', Standard8_Uri::createUri('Personas_Salir', 'Standard8'))->innerHTML(__('Salir')));
     }
     $this->_locationDiv = Wax_Document::createElement('div', $this)->setClassName('location')->appendChild(Wax_Document::createElement('strong')->innerHTML('Standard8'))->appendChild($this->_locationBar)->appendChild($this->_locationLogout);
     $this->_sidebar = Wax_Factory::createObject(array('Standard8', 'Standard8_Sidebar'));
     $this->appendChild($this->_sidebar);
     $SID = Standard8_Session::getSID();
     if (!empty($SID)) {
         $this->appendLocation(__('Administracion'), '', 'Administracion')->appendLocation(__('Configuracion'), 'Configuracion', 'Administracion', true, 'cog')->appendLocation(__('Personas'), 'Personas', 'Administracion', true, 'user');
     }
     $this->_container = Wax_Document::createElement('div', $this)->setClassName('container');
     $this->_bottom = Wax_Document::createElement('div')->setClassName('bottom')->appendChild(Wax_Document::createComment(' '));
 }
コード例 #9
0
ファイル: Locale.php プロジェクト: joksnet/php-old
 public static function parseString($string, $parameters)
 {
     if (strpos($string, '?') === false && strpos($string, '#') === false) {
         return $string;
     }
     $retval = '';
     $uri = '';
     $uriText = '';
     $uriFlag = false;
     for ($i = 0, $l = strlen($string); $i < $l; $i++) {
         $char = $string[$i];
         if ($char == self::PLACEHOLDER) {
             $replace = array_shift($parameters);
             if (strlen($replace) > 0) {
                 if ($uriFlag) {
                     $uriText .= $replace;
                 } else {
                     $retval .= $replace;
                 }
             }
         } elseif ($char == self::PLACEHOLDER_URI) {
             if ($uriFlag) {
                 $uriFlag = false;
                 $uri = array_shift($parameters);
                 if (strlen($uriText) > 0) {
                     $replace = Wax_Document::createElement('a')->setAttribute('href', $uri)->innerHTML($uriText)->__toString();
                     $retval .= $replace;
                 }
             } else {
                 $uriFlag = true;
                 $uriText = '';
             }
         } else {
             if ($uriFlag) {
                 $uriText .= $char;
             } else {
                 $retval .= $char;
             }
         }
     }
     return $retval;
 }
コード例 #10
0
ファイル: RadioGroup.php プロジェクト: joksnet/php-old
 public function __construct($options, $name = null, $value = null, $listsep = null)
 {
     parent::__construct('Div');
     if (empty($listsep)) {
         $listsep = Wax_Document::createTextNode('&nbsp;');
     } 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('&nbsp;'))->appendChild(Wax_Document::createElement('label')->innerHTML($radioLabel)->setAttribute('for', $radioId))->appendChild($listsep);
         $i++;
     }
 }
コード例 #11
0
ファイル: Modules.php プロジェクト: joksnet/php-old
 public function __construct(Standard8 $Standard8)
 {
     parent::__construct('div');
     $this->appendChild($Standard8->createTitleNav(__('Modulos')))->appendChild(Wax_Document::createElement('div')->innerHTML('404 Not Found'));
 }
コード例 #12
0
ファイル: Front.php プロジェクト: joksnet/php-old
 public function dispatch()
 {
     if ($this->_dispatched) {
         return;
     }
     $this->_dispatched = true;
     $requestURI = Wax_Request::getInstance()->getRequestUri();
     if (strpos($requestURI, '?') !== false) {
         $requestURI = substr($requestURI, 0, strpos($requestURI, '?'));
     }
     $requestURI = explode('/', $requestURI);
     $parameters = array();
     $title = array();
     $classInstance = null;
     $serverName = Wax_Request::getInstance()->getServer('SERVER_NAME');
     $serverName = explode('.', $serverName);
     if ($serverName[0] != 'standard8') {
         $currentModule = ucfirst($serverName[0]);
     } else {
         $currentModule = $this->_moduleDefault;
     }
     if (strlen($this->_moduleBase) > 0 && strlen($this->_classBase) > 0) {
         $classBase = $this->instanceClass(null, array($this->_moduleBase, $this->_classBase));
     }
     if ((strlen($this->_classForce) == 0 || sizeof($this->_classForce) == 0) && is_array($requestURI) && sizeof($requestURI) > 0) {
         foreach ($requestURI as $key => $value) {
             if (strlen($value) == 0) {
                 unset($requestURI[$key]);
             }
         }
         for ($i = sizeof($requestURI); $i > 0; $i--) {
             $continue = true;
             $filePath = str_replace(' ', '/', ucwords(implode(' ', $requestURI)));
             $fileName = $this->_binaryPath . '' . $currentModule . '/' . $filePath . '.php';
             if (file_exists($fileName)) {
                 if (include_once $fileName) {
                     $className = implode('_', $requestURI);
                     if (class_exists($className)) {
                         if ($classBase) {
                             $classReflection = new ReflectionClass($className);
                             $classConstructor = $classReflection->getConstructor();
                             $classConstructorParams = $classConstructor->getParameters();
                             if (sizeof($classConstructorParams) == 0) {
                                 $continue = false;
                             } elseif (isset($classConstructorParams[0])) {
                                 if ($classConstructorParams[0]->getClass()->name != $this->_classBase) {
                                     $continue = false;
                                 }
                             }
                         }
                         if ($continue) {
                             $title[] = implode(' :: ', $requestURI);
                             $classParam = array($currentModule, $className);
                             $classInstance = $this->instanceClass($classBase, $classParam, $parameters);
                             if ($classInstance === true) {
                                 return true;
                             } elseif ($classInstance === false) {
                                 $classInstance = null;
                             }
                         }
                     }
                 }
             }
             array_unshift($parameters, array_pop($requestURI));
         }
     }
     # Wax_Document::$head->setTitle($title, ' :: ');
     if (strlen($this->_moduleBase) > 0 && strlen($this->_classBase) > 0) {
         if ($classBase) {
             if (strlen($this->_moduleForce) > 0 && strlen($this->_classForce) > 0) {
                 $classForce = $this->instanceClass($classBase, array($this->_moduleForce, $this->_classForce));
                 if ($classForce) {
                     if (method_exists($classBase, 'appendContent')) {
                         $classBase->appendContent($classForce);
                     } else {
                         $classBase->appendChild($classForce);
                     }
                 }
             } elseif (isset($classInstance) && !is_null($classInstance)) {
                 if (method_exists($classBase, 'appendContent')) {
                     $classBase->appendContent($classInstance);
                 } else {
                     $classBase->appendChild($classInstance);
                 }
             } elseif (strlen($this->_moduleDefault) > 0 && strlen($this->_classDefault) > 0) {
                 $classDefault = $this->instanceClass($classBase, array($this->_moduleDefault, $this->_classDefault));
                 if ($classDefault) {
                     if (method_exists($classBase, 'appendContent')) {
                         $classBase->appendContent($classDefault);
                     } else {
                         $classBase->appendChild($classDefault);
                     }
                 }
             }
             Wax_Document::$body->appendChild($classBase);
         }
     } elseif (isset($classInstance) && !is_null($classInstance)) {
         Wax_Document::$body->appendChild($classInstance);
     }
     Wax_Response::getInstance()->appendBody(Wax_Document::__toString())->sendResponse();
     return true;
 }
コード例 #13
0
ファイル: Form.php プロジェクト: joksnet/php-old
 /**
  * @return Wax_Document_Body_Form
  */
 public function appendSubmitRow($addAnother = true, $continue = true, $delete = true)
 {
     $div = Wax_Document::createElement('div')->setClassName('submit');
     return $this->appendChild($div);
 }