当前位置: 首页>>代码示例>>PHP>>正文


PHP URL::getURLFromString方法代码示例

本文整理汇总了PHP中URL::getURLFromString方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::getURLFromString方法的具体用法?PHP URL::getURLFromString怎么用?PHP URL::getURLFromString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在URL的用法示例。


在下文中一共展示了URL::getURLFromString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderForm

 /**
  * Will render a specified form, the name of the form given by the first parameter;
  *
  * This method will render one of the forms for our object, invoked by giving the proper form identifier to the current form. We
  * have chosen this method of invoking forms, because we just had too many this->renderSomethingMethod (), which really had
  * an impact on code massiveness. Also, having code organized in switch/case statements leads us to be able to share common
  * settings between different forms, as we've done with the methods defined in the __CALL method above;
  *
  * For example, if we wanted to share some common configuration between a create and an edit form, we could have introduced
  * two switches in this method, one that would have set the common options, and the second, would have just passed through
  * again, and get the already set configuration options, using them. This means that if we needed to change behavior of
  * some interconnected forms, that would mean modifying the needed code one place only, which is a big advantage over
  * having separated methods for each form. Maybe if we extended this object, you guys could understand the functionality better;
  *
  * @param string $objFormToRender The name of the form to render;
  * @return mixed Depends on the rendered form if it returns something or not;
  */
 public function renderForm(S $objFormToRender, A $objFormArray = NULL)
 {
     // Make them defaults ...
     if ($objFormArray == NULL) {
         $objFormArray = new A();
     }
     // Do a switch ...
     switch ($objFormToRender) {
         case 'faqCreate':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL();
             // Do some work;
             if ($this->checkPOST(self::$objFaqTableFQuestion)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objFaqTableFQuestion)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objFaqTableFQuestion, new S(FAQ_QUESTION_CANNOT_BE_EMPTY));
                 }
                 if ($this->checkFaqQuestionIsUnique($this->getPOST(self::$objFaqTableFQuestion))->toBoolean() == FALSE) {
                     $this->setErrorOnInput(self::$objFaqTableFQuestion, new S(FAQ_QUESTION_MUST_BE_UNIQUE));
                 }
                 if ($this->checkFaqQuestionIsUnique(URL::getURLFromString($this->getPOST(self::$objFaqTableFQuestion)))->toBoolean() == FALSE) {
                     $this->setErrorOnInput(self::$objFaqTableFQuestion, new S(FAQ_QUESTION_URL_MUST_BE_UNIQUE));
                 }
             }
             if ($this->checkPOST(self::$objFaqTableFAnswer)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objFaqTableFAnswer)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objFaqTableFAnswer, new S(FAQ_ANSWER_CANNOT_BE_EMPTY));
                 }
             }
             // Get AJAX;
             $this->getAjaxErrors();
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(FAQ_ADD_FAQ))->setSQLAction(new S('update'))->setTableName(self::$objFaqTable)->setUpdateId(new S('#nextTableAutoIncrement'))->setUpdateField(self::$objFaqTableFId);
             if ($this->checkPOST(self::$objFaqTableFQuestion)->toBoolean() == TRUE) {
                 $this->setExtraUpdateData(self::$objFaqTableFSEO, URL::getURLFromString($this->getPOST(self::$objFaqTableFQuestion)));
             }
             $this->setName($objFormToRender)->setRedirect($objURLToGoBack)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setValue(new S(FAQ_ADD_FAQ))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objFaqTableFQuestion)->setLabel(new S(FAQ_QUESTION))->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(self::$objFaqTableFAnswer)->setTinyMCETextarea(new B(TRUE))->setLabel(new S(FAQ_ANSWER))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'faqEdit':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
             // Do some work;
             if ($this->checkPOST(self::$objFaqTableFAnswer)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objFaqTableFAnswer)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objFaqTableFAnswer, new S(FAQ_ANSWER_CANNOT_BE_EMPTY));
                 }
             }
             if ($this->checkPOST(self::$objFaqTableFQuestion)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objFaqTableFQuestion)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objFaqTableFQuestion, new S(FAQ_QUESTION_CANNOT_BE_EMPTY));
                 }
                 if ($this->getPOST(self::$objFaqTableFQuestion) != $this->getFaqInfoById($_GET[ADMIN_ACTION_ID], self::$objFaqTableFQuestion)) {
                     if ($this->checkFaqQuestionIsUnique($this->getPOST(self::$objFaqTableFQuestion))->toBoolean() == FALSE) {
                         $this->setErrorOnInput(self::$objFaqTableFQuestion, new S(FAQ_QUESTION_MUST_BE_UNIQUE));
                     }
                     if ($this->checkFaqQuestionIsUnique(URL::getURLFromString($this->getPOST(self::$objFaqTableFQuestion)))->toBoolean() == FALSE) {
                         $this->setErrorOnInput(self::$objFaqTableFQuestion, new S(FAQ_QUESTION_URL_MUST_BE_UNIQUE));
                     }
                 }
             }
             // Get AJAX;
             $this->getAjaxErrors();
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(FAQ_EDIT_FAQ))->setSQLAction(new S('update'))->setTableName(self::$objFaqTable)->setUpdateId($_GET[ADMIN_ACTION_ID])->setUpdateField(self::$objFaqTableFId);
             if ($this->checkPOST(self::$objFaqTableFQuestion)->toBoolean() == TRUE) {
                 $this->setExtraUpdateData(self::$objFaqTableFSEO, URL::getURLFromString($this->getPOST(self::$objFaqTableFQuestion)));
             }
             $this->setName($objFormToRender)->setRedirect($objURLToGoBack)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setInputInfoMessage($this->getHELP($objFormToRender))->setValue(new S(FAQ_EDIT_FAQ))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objFaqTableFQuestion)->setLabel(new S(FAQ_QUESTION))->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(self::$objFaqTableFAnswer)->setTinyMCETextarea(new B(TRUE))->setLabel(new S(FAQ_ANSWER))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'faqErase':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
             // Do erase it ...
             $this->_Q(_QS('doDELETE')->doToken('%table', self::$objFaqTable)->doToken('%condition', new S('%objFaqTableFId = "%Id"'))->doToken('%Id', $_GET[ADMIN_ACTION_ID]));
             // Do a redirect back;
             $this->setHeaderKey($objURLToGoBack, new S('Location'));
             break;
     }
 }
开发者ID:ajbm6,项目名称:raphpframework,代码行数:95,代码来源:00_Faq.php

示例2: renderForm

 /**
  * Will render a specified form, the name of the form given by the first parameter;
  *
  * This method will render one of the forms for our object, invoked by giving the proper form identifier to the current form.
  * We have chosen this method of invoking forms, because we just had too many this->renderSomethingMethod (), which really had
  * an impact on code massiveness. Also, having code organized in switch/case statements leads us to be able to share common
  * settings between different forms, as we've done with the methods defined in the __CALL method above;
  *
  * For example, if we wanted to share some common configuration between a create and an edit form, we could have introduced
  * two switches in this method, one that would have set the common options, and the second, would have just passed through
  * again, and get the already set configuration options, using them. This means that if we needed to change behavior of
  * some interconnected forms, that would mean modifying the needed code one place only, which is a big advantage over
  * having separated methods for each form. Maybe if we extended this object, you guys could understand the functionality;
  *
  * @param string $objFormToRender The name of the form to render;
  * @return mixed Depends on the rendered form if it returns something or not;
  */
 public function renderForm(S $objFormToRender, A $objFormArray = NULL)
 {
     // Make them defaults ...
     if ($objFormArray == NULL) {
         $objFormArray = new A();
     }
     // Do a switch ...
     switch ($objFormToRender) {
         case 'articleSearch':
             // Get some predefines;
             if (isset($_GET[ADMIN_ACTION_BY])) {
                 $objSearchBy = $_GET[ADMIN_ACTION_BY];
             } else {
                 $objSearchBy = new S();
             }
             if (isset($_GET[ADMIN_ACTION_SEARCH])) {
                 $objSearchWas = $_GET[ADMIN_ACTION_SEARCH];
             } else {
                 $objSearchWas = new S();
             }
             // Do some work;
             if ($this->checkPOST(new S('search_submit'))->toBoolean() == TRUE) {
                 if ($this->getPOST(new S('search_by'))->toLength()->toInt() == 0) {
                     if (isset($_GET[ADMIN_ACTION_SEARCH])) {
                         // Erase search terms ...
                         $this->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_ACTION_SEARCH, ADMIN_ACTION_BY))), new S('Location'));
                     }
                     // Set an input error;
                     $this->setErrorOnInput(new S('search_by'), new S(ARTICLES_SEARCH_FIELD_IS_EMPTY));
                     // Unset the post ...
                     $this->unsetPOST();
                 } else {
                     // Get what to search and where ...
                     $objWhatToSearch = $this->getPOST(new S('search_by'));
                     $objWhereToSearch = $this->getPOST(new S('search_field'));
                     // And go there ...
                     $this->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_ACTION_SEARCH, ADMIN_ACTION_BY)), new A(array($objWhatToSearch, $objWhereToSearch))), new S('Location'));
                 }
             }
             // Check the option that has been selected;
             $objWasSelected = new A(array(new B($objSearchBy == ARTICLES_SEARCH_TITLE ? TRUE : FALSE), new B($objSearchBy == ARTICLES_SEARCH_CONTENT ? TRUE : FALSE), new B($objSearchBy == ARTICLES_SEARCH_CATEGORY ? TRUE : FALSE), new B($objSearchBy == ARTICLES_SEARCH_TAGS ? TRUE : FALSE), new B($objSearchBy == ARTICLES_SEARCH_EXCERPT ? TRUE : FALSE)));
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(ARTICLES_SEARCH_BY))->setName($objFormToRender)->setInputType(new S('text'))->setInputInfoMessage($this->getHELP($objFormToRender))->setName(new S('search_by'))->setvalue($objSearchWas)->setLabel(new S(ARTICLES_SEARCH_BY))->setJSRegExpReplace(new S('[^a-zA-Z0-9 -]'))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setName(new S('search_field'))->setContainerDiv(new B(TRUE))->setLabel(new S(ARTICLES_SEARCH_IN))->setInputType(new S('option'))->setName(new S('article_title'))->setValue(new S(ARTICLES_SEARCH_TITLE))->setLabel(new S(ARTICLES_SEARCH_TITLE))->setSelected($objWasSelected[0])->setInputType(new S('option'))->setName(new S('article_content'))->setValue(new S(ARTICLES_SEARCH_CONTENT))->setLabel(new S(ARTICLES_SEARCH_CONTENT))->setSelected($objWasSelected[1])->setInputType(new S('option'))->setName(new S('article_category'))->setValue(new S(ARTICLES_SEARCH_CATEGORY))->setLabel(new S(ARTICLES_SEARCH_CATEGORY))->setSelected($objWasSelected[2])->setInputType(new S('option'))->setName(new S('article_tags'))->setValue(new S(ARTICLES_SEARCH_TAGS))->setLabel(new S(ARTICLES_SEARCH_TAGS))->setSelected($objWasSelected[3])->setInputType(new S('option'))->setName(new S('article_excerpt'))->setValue(new S(ARTICLES_SEARCH_EXCERPT))->setLabel(new S(ARTICLES_SEARCH_EXCERPT))->setSelected($objWasSelected[4])->setInputType(new S('submit'))->setContainerDiv(new B(TRUE))->setValue(new S(ARTICLES_SEARCH_BY))->setName(new S('search_submit'))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'articleCreate':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL();
             // Do some work;
             if ($this->checkPOST(self::$objArticleTableFTitle)->toBoolean() == TRUE) {
                 // Set what to check
                 $objToCheck = $this->getPOST(self::$objArticleTableFTitle);
                 if ($objToCheck->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objArticleTableFTitle, new S(ARTICLES_TITLE_CANNOT_BE_EMPTY));
                 } else {
                     // Check title is unique;
                     if ($this->checkArticleTitleIsUnique($objToCheck)->toBoolean() == FALSE) {
                         $this->setErrorOnInput(self::$objArticleTableFTitle, new S(ARTICLES_TITLE_MUST_BE_UNIQUE));
                     }
                 }
             }
             if ($this->checkPOST(self::$objArticleTableFContent)->toBoolean() == TRUE) {
                 // Set what to check
                 $objToCheck = $this->getPOST(self::$objArticleTableFContent);
                 if ($objToCheck->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objArticleTableFContent, new S(ARTICLES_CONTENT_CANNOT_BE_EMPTY));
                 }
             }
             // Check & Get;
             $this->getAjaxErrors();
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(ARTICLES_ADD_ARTICLE))->setSQLAction(new S('update'))->setTableName(self::$objArticleTable)->setUpdateId(new S('#nextTableAutoIncrement'))->setUpdateField(self::$objArticleTableFId);
             // Do some extra work;
             if ((int) $this->ATH->getCurrentUserInfoById(Authentication::$objAuthUsersTableFId)->toString() != 1) {
                 // In case we're not the BIG MAN, we're the author ...
                 $this->setExtraUpdateData(self::$objArticleTableFAuthorId, $this->ATH->getCurrentUserInfoById(Authentication::$objAuthUsersTableFId));
             }
             // Set the published date;
             $this->setExtraUpdateData(self::$objArticleTableFDatePublished, new S((string) $_SERVER['REQUEST_TIME']));
             $this->setExtraUpdateData(self::$objArticleTableFDateUpdated, new S((string) $_SERVER['REQUEST_TIME']));
             // Add the URL;
             if ($this->checkPOST(self::$objArticleTableFTitle)->toBoolean() == TRUE) {
                 $this->setExtraUpdateData(self::$objArticleTableFSEO, URL::getURLFromString(new S($this->getPOST(self::$objArticleTableFTitle) . _U . new S((string) $_SERVER['REQUEST_TIME']))));
             }
//.........这里部分代码省略.........
开发者ID:ajbm6,项目名称:raphpframework,代码行数:101,代码来源:00_Articles.php

示例3: renderForm


//.........这里部分代码省略.........
             $this->setFormEndAndExecute(new B(TRUE));
             break;
         case 'newsletterErase':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
             // Do erase it ...
             $this->_Q(_QS('doDELETE')->doToken('%table', self::$objLetterTable)->doToken('%condition', new S('%objLetterTableFId = "%Id"'))->doToken('%Id', $_GET[ADMIN_ACTION_ID]));
             // Do a redirect, and get the user back where he belongs;
             $this->setHeaderKey($objURLToGoBack, new S('Location'));
             break;
         case 'categoryCreate':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL();
             // Do some work ...
             if ($this->checkPOST(new S('categories_show_all'))->toBoolean() == TRUE) {
                 // Redirect to proper ...
                 $this->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_SHOW_ALL)), new A(array('1'))), new S('Location'));
             }
             if ($this->checkPOST(new S('add_category_submit'))->toBoolean() == TRUE) {
                 // Set some requirements;
                 $objFormHappened = new B(FALSE);
                 $objToCheck = MPTT::mpttAddUnique($this->getPOST(new S('add_category')), new S((string) $_SERVER['REQUEST_TIME']));
                 if ($objToCheck->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(new S('add_category'), new S(NEWSLETTER_CATEGORY_NAME_IS_EMPTY));
                     // Set the memory;
                     $objFormHappened->switchType();
                 } else {
                     if (self::$objMPTT->mpttCheckIfNodeExists($objToCheck)->toBoolean() == TRUE) {
                         // Check to see if the group exists, and tell the user the group exists;
                         $this->setErrorOnInput(new S('add_category'), new S(NEWSLETTER_CATEGORY_ALREADY_EXISTS));
                         // Set the memory;
                         $objFormHappened->switchType();
                     }
                     if ($this->checkCategoryURLIsUnique(URL::getURLFromString($objToCheck))->toBoolean() == FALSE) {
                         $this->setErrorOnInput(new S('add_category'), new S(NEWSLETTER_CATEGORY_URL_MUST_BE_UNIQUE));
                     }
                 }
                 // Get AJAX;
                 $this->getAjaxErrors();
                 if ($objFormHappened->toBoolean() == FALSE) {
                     // Remember if we should add it as a brother or child;
                     $objAddNodeAS = NULL;
                     // Do a switch ...
                     switch ($this->getPOST(new S('add_category_as_what'))) {
                         case NEWSLETTER_CATEGORY_CHILD:
                             $objAddNodeAS = new S((string) MPTT::FIRST_CHILD);
                             break;
                         case NEWSLETTER_CATEGORY_LAST_CHILD:
                             $objAddNodeAS = new S((string) MPTT::LAST_CHILD);
                             break;
                         case NEWSLETTER_CATEGORY_BROTHER:
                             $objAddNodeAS = new S((string) MPTT::PREVIOUS_BROTHER);
                             break;
                         case NEWSLETTER_CATEGORY_NEXT_BROTHER:
                             $objAddNodeAS = new S((string) MPTT::NEXT_BROTHER);
                             break;
                     }
                     // Add the node;
                     self::$objMPTT->mpttAddNode($objToCheck, $this->getPOST(new S('add_category_parent_or_bro')), $objAddNodeAS);
                 }
             }
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setFieldset(new S(NEWSLETTER_ADD_CATEGORY))->setName($objFormToRender)->setRedirect($objURLToGoBack)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setName(new S('categories_show_all'))->setValue(new S(NEWSLETTER_SHOW_ALL_CATEGORIES))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('submit'))->setName(new S('add_category_submit'))->setValue(new S(NEWSLETTER_ADD_CATEGORY))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(new S('add_category'))->setLabel(new S(NEWSLETTER_CATEGORY_NAME_LABEL))->setJSRegExpReplace(new S(self::REGEXP_JS_CATEGORY))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setContainerDiv(new B(TRUE))->setName(new S('add_category_as_what'))->setLabel(new S(NEWSLETTER_AS_A))->setInputType(new S('option'))->setName(new S('as_first_child'))->setLabel(new S(NEWSLETTER_CATEGORY_CHILD))->setInputType(new S('option'))->setName(new S('as_last_child'))->setLabel(new S(NEWSLETTER_CATEGORY_LAST_CHILD))->setInputType(new S('option'))->setName(new S('as_previous_brother'))->setLabel(new S(NEWSLETTER_CATEGORY_BROTHER))->setInputType(new S('option'))->setName(new S('as_next_brother'))->setLabel(new S(NEWSLETTER_CATEGORY_NEXT_BROTHER))->setInputType(new S('select'))->setContainerDiv(new B(TRUE))->setName(new S('add_category_parent_or_bro'))->setLabel(new S(NEWSLETTER_OF_CATEGORY));
             // Category parent or brother of this one ...
             foreach ($this->getCategories() as $k => $v) {
                 $this->setInputType(new S('option'))->setName($v[self::$objMPTT->objNameOfNode])->setValue($v[self::$objMPTT->objNameOfNode])->setLabel(new S(str_repeat('--' . _SP, (int) $v['depth']->toString()) . MPTT::mpttRemoveUnique(clone $v[self::$objMPTT->objNameOfNode])));
开发者ID:ajbm6,项目名称:raphpframework,代码行数:67,代码来源:00_Newsletter.php

示例4: renderForm


//.........这里部分代码省略.........
                 UNLINK(DOCUMENT_ROOT . UPLOAD_DIR . _S . 'products/images/' . $_GET[ADMIN_ACTION_ID] . _S . '128_128_' . $v['url']);
                 UNLINK(DOCUMENT_ROOT . UPLOAD_DIR . _S . 'products/images/' . $_GET[ADMIN_ACTION_ID] . _S . '320_240_' . $v['url']);
                 UNLINK(DOCUMENT_ROOT . UPLOAD_DIR . _S . 'products/images/' . $_GET[ADMIN_ACTION_ID] . _S . '640_480_' . $v['url']);
                 UNLINK(DOCUMENT_ROOT . UPLOAD_DIR . _S . 'products/images/' . $_GET[ADMIN_ACTION_ID] . _S . '800_600_' . $v['url']);
             }
             // Do erase it ...
             $this->_Q(_QS('doDELETE')->doToken('%table', self::$objProductsIMGTable)->doToken('%condition', new S('%objProductsIMGTableFId = "%Id"'))->doToken('%Id', $_GET[PRODUCTS_ID_IMAGE]));
             // Do a redirect, and get the user back where he belongs;
             $this->setHeaderKey($objURLToGoBack, new S('Location'));
             break;
         case 'productCreate':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL();
             // Do some work;
             if ($this->checkPOST(self::$objProductsTableFCode)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objProductsTableFCode)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objProductsTableFCode, new S(PRODUCTS_CODE_MUST_BE_ENTERED));
                 } else {
                     if ($this->checkCodeIsUnique($this->getPOST(self::$objProductsTableFCode))->toBoolean() == FALSE) {
                         $this->setErrorOnInput(self::$objProductsTableFCode, new S(PRODUCTS_CODE_MUST_BE_UNIQUE));
                     }
                 }
             }
             if ($this->checkPOST(self::$objProductsTableFName)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objProductsTableFName)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objProductsTableFName, new S(PRODUCTS_NAME_MUST_BE_ENTERED));
                 } else {
                     if ($this->checkProductNameIsUnique($this->getPOST(self::$objProductsTableFName))->toBoolean() == FALSE) {
                         $this->setErrorOnInput(self::$objProductsTableFName, new S(PRODUCTS_NAME_MUST_BE_UNIQUE));
                     }
                 }
             }
             if ($this->checkPOST(self::$objProductsTableFName)->toBoolean() == TRUE) {
                 if ($this->checkProductURLIsUnique(URL::getURLFromString($this->getPOST(self::$objProductsTableFName)))->toBoolean() == FALSE) {
                     $this->setErrorOnInput(self::$objProductsTableFName, new S(PRODUCTS_URL_MUST_BE_UNIQUE));
                 }
             }
             if ($this->checkPOST(self::$objProductsTableFStoc)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objProductsTableFStoc)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objProductsTableFStoc, new S(PRODUCTS_STOCK_MUST_BE_ENTERED));
                 } else {
                     // Get some requirements;
                     $objStock = new I((int) $this->getPOST(self::$objProductsTableFStoc)->toString());
                     // Do some MORE validation;
                     if ($objStock->toInt() < 0) {
                         $this->setErrorOnInput(self::$objProductsTableFStoc, new S(PRODUCTS_STOCK_CANNOT_BE_NEGATIVE));
                     }
                 }
             }
             if ($this->checkPOST(self::$objProductsTableFPrice)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objProductsTableFPrice)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objProductsTableFPrice, new S(PRODUCTS_PRICE_MUST_BE_ENTERED));
                 } else {
                     // Get some requirements;
                     $objPrice = new I((int) $this->getPOST(self::$objProductsTableFPrice)->toString());
                     // Do some MORE validation;
                     if ($objPrice->toInt() < 0) {
                         $this->setErrorOnInput(self::$objProductsTableFPrice, new S(PRODUCTS_PRICE_CANNOT_BE_NEGATIVE));
                     }
                 }
             }
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(PRODUCTS_ADD_PRODUCT))->setSQLAction(new S('update'))->setTableName(self::$objProductsTable)->setUpdateId(new S('#nextTableAutoIncrement'))->setUpdateField(self::$objProductsTableFId)->setUploadDirectory(new S('products/pdf'))->setName($objFormToRender)->setRedirect($objURLToGoBack)->setAJAXEnabledForm(new B(FALSE));
             // Set some EXTRA data;
             if ($this->checkPOST(self::$objProductsTableFName)->toBoolean() == TRUE) {
                 $this->setExtraUpdateData(self::$objProductsTableFSEO, URL::getURLFromString($this->getPOST(self::$objProductsTableFName)));
开发者ID:ajbm6,项目名称:raphpframework,代码行数:67,代码来源:00_Products.php

示例5: renderForm

 /**
  * Will render a specified form, the name of the form given by the first parameter;
  *
  * This method will render one of the forms for our object, invoked by giving the proper form identifier to the current form.
  * We have chosen this method of invoking forms, because we just had too many this->renderSomethingMethod (), which really had
  * an impact on code massiveness. Also, having code organized in switch/case statements leads us to be able to share common
  * settings between different forms, as we've done with the methods defined in the __CALL method above;
  *
  * For example, if we wanted to share some common configuration between a create and an edit form, we could have introduced
  * two switches in this method, one that would have set the common options, and the second, would have just passed through
  * again, and get the already set configuration options, using them. This means that if we needed to change behavior of
  * some interconnected forms, that would mean modifying the needed code one place only, which is a big advantage over
  * having separated methods for each form. Maybe if we extended this object, you guys could understand the functionality;
  *
  * @param string $objFormToRender The name of the form to render;
  * @return mixed Depends on the rendered form if it returns something or not;
  */
 public function renderForm(S $objFormToRender, A $objFA = NULL)
 {
     // Make them defaults ...
     if ($objFA == NULL) {
         $objFA = new A();
     }
     // Do a switch ...
     switch ($objFormToRender) {
         case 'uploadForm':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(AUDIO_STATUS_URL)), new A(array(AUDIO_STATUS_OK_URL)));
             // Do some work ...
             if ($this->checkPOST(self::$objAudioTableFTitle)->toBoolean() == TRUE) {
                 // Check non empty ...
                 if ($this->getPOST(self::$objAudioTableFTitle)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objAudioTableFTitle, new S($objFA['error_title_empty']));
                 }
             }
             if ($this->checkPOST(self::$objAudioTableFArtist)->toBoolean() == TRUE) {
                 // Check non empty ...
                 if ($this->getPOST(self::$objAudioTableFArtist)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objAudioTableFArtist, new S($objFA['error_artist_empty']));
                 }
             }
             if ($this->checkPOST(self::$objAudioTableFAlbum)->toBoolean() == TRUE) {
                 // Check non empty ...
                 if ($this->getPOST(self::$objAudioTableFAlbum)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objAudioTableFAlbum, new S($objFA['error_album_empty']));
                 }
             }
             // Check & Get;
             $this->getAjaxErrors();
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S($objFA['upload_audio_file']))->setSQLAction(new S('update'))->setTableName(self::$objAudioTable)->setUpdateId(new S('#nextTableAutoIncrement'))->setUpdateField(self::$objAudioTableFId)->setExtraUpdateData(self::$objAudioTableFUploadedDate, new S((string) $_SERVER['REQUEST_TIME']))->setExtraUpdateData(self::$objAudioTableFUploaderId, $this->ATH->getCurrentUserInfoById(Authentication::$objAuthUsersTableFId))->setExtraUpdateData(self::$objAudioTableFApproved, new S('N'))->setUploadDirectory(new S('audio/mp3/' . date('Y/m/d', $_SERVER['REQUEST_TIME'])))->setUploadImageResize(new A(array(128 => 128, 640 => 480, 800 => 600)));
             // Add the URL ...
             if ($this->checkPOST(self::$objAudioTableFTitle)->toBoolean() == TRUE && $this->checkPOST(self::$objAudioTableFArtist)->toBoolean() == TRUE) {
                 // CLONE them little monkeys ...
                 $objURL = clone $this->getPOST(self::$objAudioTableFTitle);
                 $objART = clone $this->getPOST(self::$objAudioTableFArtist);
                 // CONCAT'enate them ...
                 $this->setExtraUpdateData(self::$objAudioTableFSEO, URL::getURLFromString($objURL->appendString(_U)->appendString($objART)->appendString(_U)->appendString((string) $_SERVER['REQUEST_TIME'])));
             }
             // Continue ...
             $this->setName($objFormToRender)->setRedirect($objURLToGoBack)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setValue(new S($objFA['upload_audio_file']))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objAudioTableFTitle)->setLabel(new S($objFA['audio_file_title']))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setName(self::$objAudioTableFCategoryId)->setLabel(new S($objFA['audio_file_category']))->setContainerDiv(new B(TRUE));
             // Categories ...
             foreach ($this->getCategories() as $k => $v) {
                 $this->setInputType(new S('option'))->setName($v[self::$objMPTT->objIdField])->setValue($v[self::$objMPTT->objIdField])->setLabel(new S(str_repeat('--' . _SP, (int) $v['depth']->toString()) . MPTT::mpttRemoveUnique($v[self::$objMPTT->objNameOfNode])));
             }
             // Continue ...
             $this->setInputType(new S('text'))->setName(self::$objAudioTableFArtist)->setLabel(new S($objFA['audio_file_artist']))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objAudioTableFAlbum)->setLabel(new S($objFA['audio_file_album']))->setContainerDiv(new B(TRUE))->setInputType(new S('file'))->setName(self::$objAudioTableFFile)->setLabel(new S($objFA['audio_file_file']))->setContainerDiv(new B(TRUE))->setInputType(new S('file'))->setName(self::$objAudioTableFArtwork)->setLabel(new S($objFA['audio_file_artwork']))->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(self::$objAudioTableFLyrics)->setLabel(new S($objFA['audio_file_lyrics']))->setTinyMCETextarea(new B(TRUE))->setClass(new S('tinyMCESimple'))->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(self::$objAudioTableFDescription)->setLabel(new S($objFA['audio_file_description']))->setTinyMCETextarea(new B(TRUE))->setClass(new S('tinyMCESimple'))->setContainerDiv(new B(TRUE));
             // Notify ...
             if ($this->checkFormHasErrors()->toBoolean() == FALSE) {
                 // Go ...
                 $objMAIL = new MAIL();
                 $objMAIL->doMAIL($this->STG->getConfigKey(new S('settings_website_notification_email')), new S(AUDIO_FRONT_FILE_HAS_BEEN_UPLOADED), $this->getHELP(new S('uploadFormEMLMessage'))->doToken('%t', $this->getPOST(self::$objAudioTableFTitle))->doToken('%a', $this->getPOST(self::$objAudioTableFArtist))->doToken('%b', $this->getPOST(self::$objAudioTableFAlbum))->doToken('%u', $this->ATH->getCurrentUserInfoById(Authentication::$objAuthUsersTableFUName)));
             }
             // End form and execute ...
             $this->setFormEndAndExecute(new B(TRUE));
             break;
         case 'audioSearchOnFrontend':
             // Do the form, make it happen ...
             $this->setMethod(new S('POST'))->setName($objFormToRender);
             // Do some work ...
             if ($this->checkPOST(new S('search'))->toBoolean() == TRUE) {
                 // Get the title, and check it's name ...
                 if ($this->getPOST(new S('audio_file_title'))->toLength()->toInt() == 0) {
                     // Well, sadly, we have an issue ...
                     $this->setErrorOnInput(new S('audio_file_title'), new S($objFA['error_empty_search']));
                 } else {
                     // Notify ...
                     $objMAIL = new MAIL();
                     $objMAIL->doMAIL($this->STG->getConfigKey(new S('settings_website_notification_email')), new S(AUDIO_SEARCH_HAS_BEEN_PERFORMED), $this->getHELP(new S('audioSearchOnFrontend'))->doToken('%s', $this->getPOST(new S('audio_file_title'))));
                     // Go ...
                     $this->setHeaderKey($objURLToGoBack = URL::staticURL(new A(array(FRONTEND_SECTION_URL, AUDIO_SEARCH_URL)), new A(array(FRONTEND_AUDIO_URL, $this->getPOST(new S('audio_file_title'))->entityDecode(ENT_QUOTES)->stripSlashes()))), new S('Location'));
                 }
             }
             // Continue ...
             $this->setInputType(new S('submit'))->setName(new S('search'))->setValue(new S($objFA['search_submit']))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(new S('audio_file_title'));
             // If it's set ... add the VALUE ...
             if (isset($_GET[AUDIO_SEARCH_URL])) {
                 $this->setValue($_GET[AUDIO_SEARCH_URL]);
             }
             // Continue ...
//.........这里部分代码省略.........
开发者ID:ajbm6,项目名称:raphpframework,代码行数:101,代码来源:00_Audio.php

示例6: renderForm


//.........这里部分代码省略.........
             // Execute the form;
             $this->setFormEndAndExecute(new B(TRUE));
             break;
         case 'groupEdit':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
             // Do validation and error on it if something goes wrong;
             if ($this->checkPOST(self::$objAuthGroupTableFName)->toBoolean() == TRUE) {
                 // Set some requirements;
                 $objFormHappened = new B(FALSE);
                 if ($this->getPOST(self::$objAuthGroupTableFName)->toLength()->toInt() == 0) {
                     // Check for empty group name, and error on it. We don't allow empty group names;
                     $this->setErrorOnInput(self::$objAuthGroupTableFName, new S(GROUP_NAME_CANNOT_BE_EMPTY));
                     // Set to memory;
                     $objFormHappened->switchType();
                 } else {
                     if (self::$objMPTT->mpttCheckIfNodeExists($this->getPOST(self::$objAuthGroupTableFName))->toBoolean() == TRUE) {
                         // Check to see if the group exists, and tell the user the group exists;
                         $this->setErrorOnInput(self::$objAuthGroupTableFName, new S(GROUP_ALREADY_EXISTS));
                         // Set to memory;
                         $objFormHappened->switchType();
                     }
                 }
                 // Get AJAX;
                 $this->getAjaxErrors();
             } else {
                 // Set some requirements;
                 $objFormHappened = new B(FALSE);
             }
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setSQLAction(new S('update'))->setTableName(self::$objAuthGroupTable)->setUpdateField(self::$objAuthGroupTableFId)->setUpdateId($_GET[ADMIN_ACTION_ID]);
             if ($this->checkPOST(self::$objAuthGroupTableFName)->toBoolean() == TRUE && $objFormHappened->toBoolean() == FALSE) {
                 // Set the URL ...
                 $this->setExtraUpdateData(self::$objAuthGroupTableFSEO, URL::getURLFromString($this->getPOST(self::$objAuthGroupTableFName)))->setRedirect($objURLToGoBack);
             }
             // Continue ...
             $this->setFieldset(new S(AUTHENTICATION_EDIT_GROUP))->setName($objFormToRender)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setName(new S('submit'))->setValue(new S(AUTHENTICATION_EDIT_GROUP))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setInputInfoMessage($this->getHELP($objFormToRender))->setName(self::$objAuthGroupTableFName)->setLabel(new S(AUTHENTICATION_GROUP_NAME_LABEL))->setContainerDiv(new B(TRUE))->setJSRegExpReplace(new S('[^a-zA-Z0-9 -]'))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'groupErase':
             // The URL to go back too;
             $objNodeHasKids = new B(FALSE);
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
             // Check if it's administrator group;
             if ((int) $_GET[ADMIN_ACTION_ID]->toString() == 1) {
                 // Show the ERRORs;
                 self::$objAdministration->setErrorMessage(new S(CANNOT_ERASE_AUTHENTICATION_GROUP), $objURLToGoBack);
             } else {
                 // Check to see if there are any zone mappings;
                 if ($this->_Q(_QS('doSELECT')->doToken('%what', new S('*'))->doToken('%table', self::$objAuthZoneMTable)->doToken('%condition', new S('WHERE %objAuthZoneMTableFUGId = "%Id"
                 AND %objAuthZoneMTableFIUG = "Y"'))->doToken('%Id', $_GET[ADMIN_ACTION_ID]))->doCount()->toInt() != 0) {
                     // Do not delete groups with users in them;
                     self::$objAdministration->setErrorMessage(new S(CANNOT_DELETE_MAPPED_GROUPS), $objURLToGoBack);
                 } else {
                     // Do erase the group node from the table;
                     self::$objMPTT->mpttRemoveNode($this->getGroupInfoById($_GET[ADMIN_ACTION_ID], self::$objAuthGroupTableFName));
                     // Redirect back;
                     $this->setHeaderKey($objURLToGoBack, new S('Location'));
                 }
             }
             // BK;
             break;
         case 'groupMove':
             // Set some predefines;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_TO, ADMIN_ACTION_TYPE)));
             // Get names, as they are unique;
             $objThatIsMoved = $this->getGroupInfoById($_GET[ADMIN_ACTION_ID], self::$objAuthGroupTableFName);
开发者ID:ajbm6,项目名称:raphpframework,代码行数:67,代码来源:00_Authentication.php

示例7: mpttNewNextSibling

 /**
  * Will add the node as the next sibling of the parent node;
  *
  * This method will determine the parent node data it needs to add the current given node as the next sibling of the
  * passed parent node;
  *
  * @param S $objNodeName The node name to add;
  * @param S $objNodePName The parent node to relate to;
  */
 private function mpttNewNextSibling(S $objNodeName, S $objNodePName)
 {
     // Get some information from them;
     $objPLefty = new S((string) ((int) $this->mpttGetNodeInfoByName($objNodePName, $this->objRightField)->toString() + 1));
     $objPRight = new S((string) ((int) $this->mpttGetNodeInfoByName($objNodePName, $this->objRightField)->toString() + 2));
     // Update required;
     $this->shiftRL($objPLefty, new S('2'));
     // Make the new node;
     // Make the new node;
     $this->_Q(_QS('doINSERT')->doToken('%table', $this->objTable)->doToken('%condition', new S('%objNameOfNode = "%nId", %objSEOName = "%uId",
     %objLeftyField = "%fId", %objRightField = "%sId", %objNodeDate = "%dId"'))->doToken('%nId', $objNodeName)->doToken('%fId', $objPLefty)->doToken('%sId', $objPRight)->doToken('%uId', URL::getURLFromString($objNodeName))->doToken('%dId', $_SERVER['REQUEST_TIME']));
 }
开发者ID:ajbm6,项目名称:raphpframework,代码行数:21,代码来源:16_ALG.php

示例8: renderForm

 /**
  * Will render a specified form, the name of the form given by the first parameter;
  *
  * This method will render one of the forms for our object, invoked by giving the proper form identifier to the current form.
  * We have chosen this method of invoking forms, because we just had too many this->renderSomethingMethod (), which really had
  * an impact on code massiveness. Also, having code organized in switch/case statements leads us to be able to share common
  * settings between different forms, as we've done with the methods defined in the __CALL method above;
  *
  * For example, if we wanted to share some common configuration between a create and an edit form, we could have introduced
  * two switches in this method, one that would have set the common options, and the second, would have just passed through
  * again, and get the already set configuration options, using them. This means that if we needed to change behavior of
  * some interconnected forms, that would mean modifying the needed code one place only, which is a big advantage over
  * having separated methods for each form. Maybe if we extended this object, you guys could understand the functionality best;
  *
  * @param string $objFormToRender The name of the form to render;
  * @return mixed Depends on the rendered form if it returns something or not;
  */
 public function renderForm(S $objFormToRender, A $objFA = NULL)
 {
     // Make them defaults ...
     if ($objFA == NULL) {
         $objFA = new A();
     }
     // Do a switch ...
     switch ($objFormToRender) {
         case 'textSearch':
             // Get some predefines;
             if (isset($_GET[ADMIN_ACTION_BY])) {
                 $objSearchBy = $_GET[ADMIN_ACTION_BY];
             } else {
                 $objSearchBy = new S();
             }
             if (isset($_GET[ADMIN_ACTION_SEARCH])) {
                 $objSearchWas = $_GET[ADMIN_ACTION_SEARCH];
             } else {
                 $objSearchWas = new S();
             }
             // Do some work;
             if ($this->checkPOST(new S('search_submit'))->toBoolean() == TRUE) {
                 if ($this->getPOST(new S('search_by'))->toLength()->toInt() == 0) {
                     if (isset($_GET[ADMIN_ACTION_SEARCH])) {
                         // Erase search terms ...
                         $this->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_ACTION_SEARCH, ADMIN_ACTION_BY))), new S('Location'));
                     }
                     // Set an input error;
                     $this->setErrorOnInput(new S('search_by'), new S(ARTICLE_SEARCH_FIELD_IS_EMPTY));
                     // Unset the post ...
                     $this->unsetPOST();
                 } else {
                     // Get what to search and where ...
                     $objWhatToSearch = $this->getPOST(new S('search_by'));
                     $objWhereToSearch = $this->getPOST(new S('search_field'));
                     // And go there ...
                     $this->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_ACTION_SEARCH, ADMIN_ACTION_BY)), new A(array($objWhatToSearch, $objWhereToSearch))), new S('Location'));
                 }
             }
             // Check the option that has been selected;
             $objWasSelected = new A(array(new B($objSearchBy == TEXTS_SEARCH_TITLE ? TRUE : FALSE), new B($objSearchBy == TEXTS_SEARCH_CONTENT ? TRUE : FALSE)));
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(TEXTS_SEARCH_BY))->setName($objFormToRender)->setInputType(new S('text'))->setInputInfoMessage($this->getHELP($objFormToRender))->setName(new S('search_by'))->setvalue($objSearchWas)->setLabel(new S(TEXTS_SEARCH_BY))->setJSRegExpReplace(new S('[^a-zA-Z0-9 -]'))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setName(new S('search_field'))->setContainerDiv(new B(TRUE))->setLabel(new S(TEXTS_SEARCH_IN))->setInputType(new S('option'))->setName(new S('article_title'))->setValue(new S(TEXTS_SEARCH_TITLE))->setLabel(new S(TEXTS_SEARCH_TITLE))->setSelected($objWasSelected[0])->setInputType(new S('option'))->setName(new S('article_content'))->setValue(new S(TEXTS_SEARCH_CONTENT))->setLabel(new S(TEXTS_SEARCH_CONTENT))->setSelected($objWasSelected[1])->setInputType(new S('submit'))->setContainerDiv(new B(TRUE))->setValue(new S(TEXTS_SEARCH_BY))->setName(new S('search_submit'))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'textCreate':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL();
             // Do some work;
             if ($this->checkPOST(self::$objTextTableFTitle)->toBoolean() == TRUE) {
                 if ($this->getPOST(self::$objTextTableFTitle)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objTextTableFTitle, new S(TEXTS_TITLE_CANNOT_BE_EMPTY));
                 } else {
                     // Set some requirements ...
                     $objToCheck = $this->getPOST(self::$objTextTableFTitle);
                     // Check title is unique;
                     if ($this->checkTextTitleIsUnique($objToCheck)->toBoolean() == FALSE) {
                         $this->setErrorOnInput(self::$objTextTableFTitle, new S(TEXTS_TITLE_MUST_BE_UNIQUE));
                     }
                     // Check URL is unique;
                     if ($this->checkTextURLIsUnique(URL::getURLFromString(clone $objToCheck))->toBoolean() == FALSE) {
                         $this->setErrorOnInput(self::$objTextTableFTitle, new S(TEXTS_URL_MUST_BE_UNIQUE));
                     }
                 }
                 if ($this->getPOST(self::$objTextTableFContent)->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(self::$objTextTableFContent, new S(TEXTS_CONTENT_CANNOT_BE_EMPTY));
                 }
             }
             // Get AJAX;
             $this->getAjaxErrors();
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setName($objFormToRender)->setAJAXEnabledForm(new B(FALSE))->setFieldset(new S(TEXTS_ADD_ARTICLE))->setRedirect($objURLToGoBack)->setSQLAction(new S('update'))->setTableName(self::$objTextTable)->setUpdateId(new S('#nextTableAutoIncrement'))->setUpdateField(self::$objTextTableFId);
             if ($this->checkPOST(self::$objTextTableFTitle)->toBoolean() == TRUE) {
                 $this->setExtraUpdateData(self::$objTextTableFSEO, URL::getURLFromString($this->getPOST(self::$objTextTableFTitle)));
             }
             // ONLY if != BIG-MAN;
             if ((int) $this->ATH->getCurrentUserInfoById(Authentication::$objAuthUsersTableFId)->toString() != 1) {
                 $this->setExtraUpdateData(self::$objTextTableAuthorId, $this->ATH->getCurrentUserInfoById(Authentication::$objAuthUsersTableFId));
             }
             // Add the SEO ...
             $this->setExtraUpdateData(self::$objTextTableFDatePublished, new S((string) $_SERVER['REQUEST_TIME']))->setInputType(new S('submit'))->setValue(new S(TEXTS_ADD_ARTICLE))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objTextTableFTags)->setLabel(new S(TEXTS_TAGS))->setJSRegExpReplace(new S(self::REGEXP_JS_TAGS))->setContainerDiv(new B(TRUE));
             // If we're the BIG MAN, we can set the author of an entry;
             if ((int) $this->ATH->getCurrentUserInfoById(Authentication::$objAuthUsersTableFId)->toString() == 1) {
                 $this->setInputType(new S('select'))->setName(self::$objTextTableFAuthorId)->setLabel(new S(TEXTS_AUTHOR))->setContainerDiv(new B(TRUE));
//.........这里部分代码省略.........
开发者ID:ajbm6,项目名称:raphpframework,代码行数:101,代码来源:00_Texts.php

示例9: renderForm

 /**
  * Will render a specified form, the name of the form given by the first parameter;
  *
  * This method will render one of the forms for our object, invoked by giving the proper form identifier to the current form. We
  * have chosen this method of invoking forms, because we just had too many this->renderSomethingMethod (), which really had
  * an impact on code massiveness. Also, having code organized in switch/case statements leads us to be able to share common
  * settings between different forms, as we've done with the methods defined in the __CALL method above;
  *
  * For example, if we wanted to share some common configuration between a create and an edit form, we could have introduced
  * two switches in this method, one that would have set the common options, and the second, would have just passed through
  * again, and get the already set configuration options, using them. This means that if we needed to change behavior of
  * some interconnected forms, that would mean modifying the needed code one place only, which is a big advantage over
  * having separated methods for each form. Maybe if we extended this object, you guys could understand the functionality better;
  *
  * @param string $objFormToRender The name of the form to render;
  * @return mixed Depends on the rendered form if it returns something or not;
  */
 public function renderForm(S $objFormToRender, A $objFormArray = NULL)
 {
     // Make them defaults ...
     if ($objFormArray == NULL) {
         $objFormArray = new A();
     }
     // Do a switch ...
     switch ($objFormToRender) {
         case 'widgetSearch':
             // Do the form, make it happen ...
             $this->setMethod(new S('POST'))->setName($objFormToRender);
             // Do some work ...
             if ($this->checkPOST(new S('search_lyrics'))->toBoolean() == TRUE) {
                 // Get the title, and check it's name ...
                 if ($this->getPOST(new S('lyrics_search_keyword'))->toLength()->toInt() == 0) {
                     // Well, sadly, we have an issue ...
                     $this->setErrorOnInput(new S('lyrics_search_keyword'), new S('Nu ai completat cautarea!'));
                 } else {
                     // Go ...
                     $this->setHeaderKey($objURLToGoBack = URL::staticURL(new A(array(FRONTEND_SECTION_URL, LYRICS_SEARCH_URL)), new A(array(FRONTEND_LYRICS_URL, $this->getPOST(new S('lyrics_search_keyword'))->entityDecode(ENT_QUOTES)->stripSlashes()))), new S('Location'));
                 }
             }
             // Continue ...
             $this->setInputType(new S('text'))->setName(new S('lyrics_search_keyword'));
             // If it's set ... add the VALUE ...
             if (isset($_GET[LYRICS_SEARCH_URL])) {
                 $this->setValue($_GET[LYRICS_SEARCH_URL]);
             }
             // Continue ...
             $this->setLabel(new S('Cuvant'))->setContainerDiv(new B(TRUE))->setInputType(new S('submit'))->setName(new S('search_lyrics'))->setValue(new S('Cauta'))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'lyricCreate':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL();
             $objErrorHappen = new B(FALSE);
             // Do some work;
             if ($this->checkPOST(self::$objLyricsTableFTitle)->toBoolean() == TRUE) {
                 // Check != 0 ...
                 if ($this->getPOST(self::$objLyricsTableFTitle)->toLength()->toInt() == 0) {
                     self::setErrorOnInput(self::$objLyricsTableFTitle, new S(LYRICS_TITLE_CANNOT_BE_EMPTY));
                     $objErrorHappen = new B(TRUE);
                 }
             }
             if ($this->checkPOST(self::$objLyricsTableFArtist)->toBoolean() == TRUE) {
                 // Check != 0 ...
                 if ($this->getPOST(self::$objLyricsTableFArtist)->toLength()->toInt() == 0) {
                     self::setErrorOnInput(self::$objLyricsTableFArtist, new S(LYRICS_ARTIST_CANNOT_BE_EMPTY));
                     $objErrorHappen = new B(TRUE);
                 }
             }
             if ($this->checkPOST(self::$objLyricsTableFAlbum)->toBoolean() == TRUE) {
                 // Check != 0 ...
                 if ($this->getPOST(self::$objLyricsTableFAlbum)->toLength()->toInt() == 0) {
                     self::setErrorOnInput(self::$objLyricsTableFAlbum, new S(LYRICS_ALBUM_CANNOT_BE_EMPTY));
                     $objErrorHappen = new B(TRUE);
                 }
             }
             // Get AJAX;
             $this->getAjaxErrors();
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(LYRICS_ADD_LYRIC))->setSQLAction(new S('update'))->setTableName(self::$objLyricsTable)->setUpdateId(new S('#nextTableAutoIncrement'))->setUpdateField(self::$objLyricsTableFId)->setExtraUpdateData(self::$objLyricsTableFDateAdded, new S((string) $_SERVER['REQUEST_TIME']));
             if ($this->checkPOST(self::$objLyricsTableFTitle)->toBoolean() == TRUE && $objErrorHappen->toBoolean() == FALSE) {
                 $this->setExtraUpdateData(self::$objLyricsTableFSEO, URL::getURLFromString(new S($this->getPOST(self::$objLyricsTableFTitle) . _U . $this->getPOST(self::$objLyricsTableFArtist) . _U . $this->getPOST(self::$objLyricsTableFAlbum) . _U . $_SERVER['REQUEST_TIME'])));
             }
             $this->setName($objFormToRender)->setRedirect($objURLToGoBack)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setInputInfoMessage($this->getHELP($objFormToRender))->setValue(new S(LYRICS_ADD_LYRIC))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objLyricsTableFTitle)->setLabel(new S(LYRICS_TITLE))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objLyricsTableFArtist)->setLabel(new S(LYRICS_ARTIST))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objLyricsTableFAlbum)->setLabel(new S(LYRICS_ALBUM))->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(self::$objLyricsTableFLyrics)->setLabel(new S(LYRICS_LYRIC))->setTinyMCETextarea(new B(TRUE))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'lyricEdit':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
             $objErrorHappen = new B(FALSE);
             // Do some work;
             if ($this->checkPOST(self::$objLyricsTableFTitle)->toBoolean() == TRUE) {
                 // Check != 0 ...
                 if ($this->getPOST(self::$objLyricsTableFTitle)->toLength()->toInt() == 0) {
                     self::setErrorOnInput(self::$objLyricsTableFTitle, new S(LYRICS_TITLE_CANNOT_BE_EMPTY));
                     $objErrorHappen = new B(TRUE);
                 }
             }
             if ($this->checkPOST(self::$objLyricsTableFArtist)->toBoolean() == TRUE) {
                 // Check != 0 ...
                 if ($this->getPOST(self::$objLyricsTableFArtist)->toLength()->toInt() == 0) {
                     self::setErrorOnInput(self::$objLyricsTableFArtist, new S(LYRICS_ARTIST_CANNOT_BE_EMPTY));
                     $objErrorHappen = new B(TRUE);
//.........这里部分代码省略.........
开发者ID:ajbm6,项目名称:raphpframework,代码行数:101,代码来源:00_Lyrics.php


注:本文中的URL::getURLFromString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。