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


PHP B::switchType方法代码示例

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


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

示例1: renderForm


//.........这里部分代码省略.........
                 UNLINK(DOCUMENT_ROOT . UPLOAD_DIR . _S . 'products/images' . _S . '320_240_' . $v['url']);
                 UNLINK(DOCUMENT_ROOT . UPLOAD_DIR . _S . 'products/images' . _S . '640_480_' . $v['url']);
                 UNLINK(DOCUMENT_ROOT . UPLOAD_DIR . _S . 'products/images' . _S . '800_600_' . $v['url']);
             }
             // Do erase associated images;
             $this->_Q(_QS('doDELETE')->doToken('%table', self::$objProductsIMGTable)->doToken('%condition', new S('%objProductsIMGTableFProdId = "%Id"'))->doToken('%Id', $_GET[ADMIN_ACTION_ID]));
             // Do erase associated properties ...
             $this->_Q(_QS('doDELETE')->doToken('%table', self::$objProductsPropertyTable)->doToken('%condition', new S('%objProductsPropertyTableFPId = "%Id"'))->doToken('%Id', $_GET[ADMIN_ACTION_ID]));
             // Do erase associated PDF file;
             $objPDF = $this->getProductInfoById($_GET[ADMIN_ACTION_ID], self::$objProductsTableFPDF);
             if ($objPDF->toLength()->toInt() != 0) {
                 UNLINK(DOCUMENT_ROOT . UPLOAD_DIR . _S . 'products/pdf' . _S . $objPDF);
             }
             // Do erase it ...
             $this->_Q(_QS('doDELETE')->doToken('%table', self::$objProductsTable)->doToken('%condition', new S('%objProductsTableFId = "%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(CATEGORY_NAME_CANNOT_BE_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(CATEGORY_ALREADY_EXISTS));
                         // Set the memory;
                         $objFormHappened->switchType();
                     }
                     if ($this->checkCategoryURLIsUnique(URL::getURLFromString($objToCheck))->toBoolean() == FALSE) {
                         $this->setErrorOnInput(new S('add_category'), new S(PRODUCTS_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;
                     switch ($this->getPOST(new S('add_category_as_what'))) {
                         case PRODUCTS_CATEGORY_CHILD:
                             $objAddNodeAS = new S((string) MPTT::FIRST_CHILD);
                             break;
                         case PRODUCTS_CATEGORY_LAST_CHILD:
                             $objAddNodeAS = new S((string) MPTT::LAST_CHILD);
                             break;
                         case PRODUCTS_CATEGORY_BROTHER:
                             $objAddNodeAS = new S((string) MPTT::PREVIOUS_BROTHER);
                             break;
                         case PRODUCTS_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);
开发者ID:ajbm6,项目名称:raphpframework,代码行数:67,代码来源:00_Products.php

示例2: renderForm


//.........这里部分代码省略.........
             // Do a redirect, and get the user back where he belongs;
             $this->setHeaderKey($objURLToGoBack, new S('Location'));
             // BK;
             break;
         case 'commentEdit':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setFieldset(new S(ARTICLES_EDIT_COMMENT))->setAJAXEnabledForm(new B(FALSE))->setRedirect($objURLToGoBack)->setSQLAction(new S('update'))->setTableName(self::$objCommentsTable)->setUpdateId($_GET[ADMIN_ACTION_ID])->setUpdateField(self::$objCommentsTableFId)->setName($objFormToRender)->setInputType(new S('submit'))->setValue(new S(ARTICLES_EDIT_COMMENT))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setName(self::$objCommentsTableFApproved)->setLabel(new S(ARTICLES_COMMENT_APPROVED))->setContainerDiv(new B(TRUE))->setInputType(new S('option'))->setName(new S('no'))->setValue(new S('N'))->setLabel(new S(ARTICLES_CAN_COMMENT_NO))->setInputType(new S('option'))->setName(new S('yes'))->setValue(new S('Y'))->setLabel(new S(ARTICLES_CAN_COMMENT_YES))->setInputType(new S('textarea'))->setName(self::$objCommentsTableFComment)->setLabel(new S(ARTICLES_COMMENT))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'commentErase':
             // 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::$objCommentsTable)->doToken('%condition', new S('%objCommentsTableFId = "%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 = $this->getPOST(new S('add_category'));
                 if ($objToCheck->toLength()->toInt() == 0) {
                     $this->setErrorOnInput(new S('add_category'), new S(ARTICLES_CATEGORY_NAME_IS_EMPTY));
                     // Set the memory;
                     $objFormHappened->switchType();
                 } else {
                     if (self::$objMPTT->mpttCheckIfNodeExists($objToCheck = MPTT::mpttAddUnique($objToCheck, new S((string) $_SERVER['REQUEST_TIME'])))->toBoolean() == TRUE) {
                         // Check to see if the group exists, and tell the user the group exists;
                         $this->setErrorOnInput(new S('add_category'), new S(ARTICLES_CATEGORY_ALREADY_EXISTS));
                         // Set the memory;
                         $objFormHappened->switchType();
                     }
                     if ($this->checkCategoryURLIsUnique(URL::getURLFromString($objToCheck))->toBoolean() == FALSE) {
                         $this->setErrorOnInput(new S('add_category'), new S(ARTICLES_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 ARTICLES_CATEGORY_CHILD:
                             $objAddNodeAS = new S((string) MPTT::FIRST_CHILD);
                             break;
                         case ARTICLES_CATEGORY_LAST_CHILD:
                             $objAddNodeAS = new S((string) MPTT::LAST_CHILD);
                             break;
                         case ARTICLES_CATEGORY_BROTHER:
                             $objAddNodeAS = new S((string) MPTT::PREVIOUS_BROTHER);
                             break;
                         case ARTICLES_CATEGORY_NEXT_BROTHER:
                             $objAddNodeAS = new S((string) MPTT::NEXT_BROTHER);
                             break;
                     }
                     // Add the node;
开发者ID:ajbm6,项目名称:raphpframework,代码行数:67,代码来源:00_Articles.php

示例3: renderForm


//.........这里部分代码省略.........
                 $this->setRedirect($objURLToGoBack);
             }
             $this->setName($objFormToRender)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setName(new S('submit'))->setValue(new S(NEWSLETTER_EDIT))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objLetterTableFEML)->setLabel(new S(NEWSLETTER_EMAIL))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objLetterTableFFirstName)->setLabel(new S(NEWSLETTER_FIRSTNAME))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objLetterTableFLastName)->setLabel(new S(NEWSLETTER_LASTNAME))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setName(self::$objLetterTableFType)->setLabel(new S(NEWSLETTER_TYPE))->setContainerDiv(new B(TRUE))->setInputType(new S('option'))->setName(new S('nw_html'))->setValue(new S('HTML'))->setLabel(new S(NEWSLETTER_HTML))->setContainerDiv(new B(TRUE))->setInputType(new S('option'))->setName(new S('nw_txt'))->setValue(new S('PLAIN'))->setLabel(new S(NEWSLETTER_PLAIN))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setLabel(new S(NEWSLETTER_CATEGORY))->setName(self::$objLetterTableFCategoryId)->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->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;
开发者ID:ajbm6,项目名称:raphpframework,代码行数:67,代码来源:00_Newsletter.php

示例4: renderForm


//.........这里部分代码省略.........
                 $this->setHeaderKey($objURLToGoBack, new S('Location'));
             }
             // BK;
             break;
         case 'commentEdit':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setFieldset(new S(AUDIO_EDIT_COMMENT))->setAJAXEnabledForm(new B(FALSE))->setRedirect($objURLToGoBack)->setSQLAction(new S('update'))->setTableName(self::$objCommentsTable)->setUpdateId($_GET[ADMIN_ACTION_ID])->setUpdateField(self::$objCommentsTableFId)->setName($objFormToRender)->setInputType(new S('submit'))->setValue(new S(AUDIO_EDIT_COMMENT))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setName(self::$objCommentsTableFApproved)->setLabel(new S(AUDIO_COMMENT_APPROVED))->setContainerDiv(new B(TRUE))->setInputType(new S('option'))->setName(new S('no'))->setValue(new S('N'))->setLabel(new S(AUDIO_CAN_COMMENT_NO))->setInputType(new S('option'))->setName(new S('yes'))->setValue(new S('Y'))->setLabel(new S(AUDIO_CAN_COMMENT_YES))->setInputType(new S('textarea'))->setName(self::$objCommentsTableFComment)->setLabel(new S(AUDIO_COMMENT))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'commentErase':
             // 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::$objCommentsTable)->doToken('%condition', new S('%objCommentsTableFId = "%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(AUDIO_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(AUDIO_CATEGORY_ALREADY_EXISTS));
                         // Set the memory;
                         $objFormHappened->switchType();
                     }
                     if ($this->checkCategoryURLIsUnique(URL::getURLFromString($objToCheck))->toBoolean() == FALSE) {
                         $this->setErrorOnInput(new S('add_category'), new S(AUDIO_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;
                     switch ($this->getPOST(new S('add_category_as_what'))) {
                         case AUDIO_CATEGORY_CHILD:
                             $objAddNodeAS = new S((string) MPTT::FIRST_CHILD);
                             break;
                         case AUDIO_CATEGORY_LAST_CHILD:
                             $objAddNodeAS = new S((string) MPTT::LAST_CHILD);
                             break;
                         case AUDIO_CATEGORY_BROTHER:
                             $objAddNodeAS = new S((string) MPTT::PREVIOUS_BROTHER);
                             break;
                         case AUDIO_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);
开发者ID:ajbm6,项目名称:raphpframework,代码行数:67,代码来源:00_Audio.php

示例5: renderForm


//.........这里部分代码省略.........
                     }
                     // Set an error, notify me ...
                     $this->setErrorOnInput(new S('search_user_by'), new S(AUTHENTICATION_SEARCH_FIELD_IS_EMPTY));
                     // Unset the post ...
                     $this->unsetPOST();
                 } else {
                     // Get what to search and where ...
                     $objWhatToSearch = $this->getPOST(new S('search_user_by'));
                     $objWhereToSearch = $this->getPOST(new S('search_user_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'));
                 }
             }
             $objWasSelected = new A(array(new B($objSearchBy == AUTHENTICATION_PROFILE_USERNAME ? TRUE : FALSE), new B($objSearchBy == AUTHENTICATION_PROFILE_EMAIL ? TRUE : FALSE), new B($objSearchBy == AUTHENTICATION_PROFILE_GROUP ? TRUE : FALSE)));
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(AUTHENTICATION_SEARCH_USER_BY))->setName($objFormToRender)->setInputType(new S('text'))->setInputInfoMessage($this->getHELP($objFormToRender))->setName(new S('search_user_by'))->setvalue($objSearchWas)->setLabel(new S(AUTHENTICATION_SEARCH_USER_BY))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setName(new S('search_user_field'))->setContainerDiv(new B(TRUE))->setLabel(new S(AUTHENTICATION_SEARCH_USER_IN))->setInputType(new S('option'))->setName(new S('username_search'))->setValue(new S(AUTHENTICATION_PROFILE_USERNAME))->setLabel(new S(AUTHENTICATION_PROFILE_USERNAME))->setSelected($objWasSelected[0])->setInputType(new S('option'))->setName(new S('email_search'))->setValue(new S(AUTHENTICATION_PROFILE_EMAIL))->setLabel(new S(AUTHENTICATION_PROFILE_EMAIL))->setSelected($objWasSelected[1])->setInputType(new S('option'))->setName(new S('group_serach'))->setValue(new S(AUTHENTICATION_PROFILE_GROUP))->setLabel(new S(AUTHENTICATION_PROFILE_GROUP))->setSelected($objWasSelected[2])->setInputType(new S('submit'))->setContainerDiv(new B(TRUE))->setValue(new S(AUTHENTICATION_SEARCH_USER_BY))->setName(new S('search_submit'))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'groupCreate':
             // 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'));
             }
             // Do some work;
             if ($this->checkPOST(new S('submit_add_group'))->toBoolean() == TRUE) {
                 // Set some requirements;
                 $objFormHappened = new B(FALSE);
                 if ($this->getPOST(new S('group'))->toLength()->toInt() == 0) {
                     // Check for empty group name, and error on it. We don't allow empty group names;
                     $this->setErrorOnInput(new S('group'), new S(GROUP_NAME_CANNOT_BE_EMPTY));
                     // Set to memory;
                     $objFormHappened->switchType();
                 } else {
                     if (self::$objMPTT->mpttCheckIfNodeExists($this->getPOST(new S('group')))->toBoolean() == TRUE) {
                         // Check to see if the group exists, and tell the user the group exists;
                         $this->setErrorOnInput(new S('group'), new S(GROUP_ALREADY_EXISTS));
                         // Set to memory;
                         $objFormHappened->switchType();
                     }
                 }
                 // Get AJAX;
                 $this->getAjaxErrors();
                 if ($objFormHappened->toBoolean() == FALSE) {
                     // Remember if we should add it as a brother or child;
                     $objAddNodeAS = NULL;
                     // Switch ...
                     switch ($this->getPOST(new S('group_as_what'))) {
                         case AUTHENTICATION_GROUP_CHILD:
                             $objAddNodeAS = new S((string) MPTT::FIRST_CHILD);
                             break;
                         case AUTHENTICATION_GROUP_LAST_CHILD:
                             $objAddNodeAS = new S((string) MPTT::LAST_CHILD);
                             break;
                         case AUTHENTICATION_GROUP_BROTHER:
                             $objAddNodeAS = new S((string) MPTT::PREVIOUS_BROTHER);
                             break;
                         case AUTHENTICATION_GROUP_NEXT_BROTHER:
                             $objAddNodeAS = new S((string) MPTT::NEXT_BROTHER);
                             break;
                     }
                     // Add the node;
                     self::$objMPTT->mpttAddNode($this->getPOST(new S('group')), $this->getPOST(new S('group_parent_or_bro')), $objAddNodeAS);
                     // Do a redirect back;
                     $this->setHeaderKey($objURLToGoBack, new S('Location'));
开发者ID:ajbm6,项目名称:raphpframework,代码行数:67,代码来源:00_Authentication.php

示例6: mpttRemoveNode

 /**
  * Will remove a node, either recursive or by promotion. This method, given a node name to remove, will search for that node
  * and will remove it either by promotion (promoting the childs to a root LEVEL) - or by recursivelly deleting its childs;
  *
  * @param S $objNodeToRemove The node to remove
  * @param B $objRemoveRecursive Remove either recursive, or promote children
  * @return B Will return true if the node is removed
  * @author Catalin Z. Alexandru <catalin.zamfir@raphpframework.ro>
  * @copyright Under the terms of the GNU General Public License v3
  * @version $Id: 16_ALG.php 335 2009-10-12 12:21:47Z catalin.zamfir $
  * @since Version 1.0
  * @access public
  */
 public function mpttRemoveNode(S $objNodeToRemove, B $objRemoveRecursive = NULL)
 {
     // Set some predefines;
     if ($objRemoveRecursive == NULL) {
         $objRemoveRecursive = new B(FALSE);
     }
     // Determine if the node we want to delete is a LEAF node, or not!
     $objLeafNodes = $this->mpttGetTreeLeafs();
     $objIsALeafNd = new B(FALSE);
     // Parse the array;
     foreach ($objLeafNodes as $k => $v) {
         if ($v[$this->objNameOfNode] == $objNodeToRemove) {
             $objIsALeafNd->switchType();
         }
     }
     // Get some node information;
     $objQ = $this->_Q(_QS('doSELECT')->doToken('%what', new S('*'))->doToken('%table', $this->objTable)->doToken('%condition', new S('WHERE %objNameOfNode = "%nId"'))->doToken('%nId', $objNodeToRemove));
     // Set left, right and width;
     $objLefty = $objQ->offsetGet(0)->offsetGet($this->objLeftyField);
     $objRight = $objQ->offsetGet(0)->offsetGet($this->objRightField);
     $objWidth = new S((string) ((int) $objRight->toString() - (int) $objLefty->toString() + 1));
     // Check if we do a recursive delete, or promotion delete;
     if ($objIsALeafNd->toBoolean() == TRUE || $objRemoveRecursive->toBoolean() == TRUE) {
         // Do the node deletion;
         $this->_Q(_QS('doDELETE')->doToken('%table', $this->objTable)->doToken('%condition', new S('%objLeftyField BETWEEN %LowerLimit AND %UpperLimit'))->doToken('%LowerLimit', $objLefty)->doToken('%UpperLimit', $objRight));
         // Update the right-hand side;
         $this->_Q(_QS('doUPDATE')->doToken('%table', $this->objTable)->doToken('%condition', new S('%objRightField = %objRightField - %LimitWidth
         WHERE %objRightField > %UpperLimit'))->doToken('%LimitWidth', $objWidth)->doToken('%UpperLimit', $objRight));
         // Update the lefty-hand side;
         $this->_Q(_QS('doUPDATE')->doToken('%table', $this->objTable)->doToken('%condition', new S('%objLeftyField = %objLeftyField - %LimitWidth
         WHERE %objLeftyField > %UpperLimit'))->doToken('%LimitWidth', $objWidth)->doToken('%UpperLimit', $objRight));
         // Do return ...
         return new B(TRUE);
     } else {
         // Do the node deletion;
         $this->_Q(_QS('doDELETE')->doToken('%table', $this->objTable)->doToken('%condition', new S('%objLeftyField = %LowerLimit'))->doToken('%LowerLimit', $objLefty));
         // If we removed, promote kids;
         $this->_Q(_QS('doUPDATE')->doToken('%table', $this->objTable)->doToken('%condition', new S('%objRightField =
         %objRightField - 1, %objLeftyField = %objLeftyField - 1
         WHERE %objLeftyField BETWEEN %LowerLimit AND %UpperLimit'))->doToken('%LowerLimit', $objLefty)->doToken('%UpperLimit', $objRight));
         // Update the right-hand side;
         $this->_Q(_QS('doUPDATE')->doToken('%table', $this->objTable)->doToken('%condition', new S('%objRightField =
         %objRightField - 2 WHERE %objRightField > %UpperLimit'))->doToken('%UpperLimit', $objRight));
         // Update the lefty-hand side;
         $this->_Q(_QS('doUPDATE')->doToken('%table', $this->objTable)->doToken('%condition', new S('%objLeftyField =
         %objLeftyField - 2 WHERE %objLeftyField > %UpperLimit'))->doToken('%UpperLimit', $objRight));
         // Do return ...
         return new B(TRUE);
     }
 }
开发者ID:ajbm6,项目名称:raphpframework,代码行数:63,代码来源:16_ALG.php

示例7: renderForm


//.........这里部分代码省略.........
             // Do a redirect, and get the user back where he belongs;
             $this->setHeaderKey($objURLToGoBack, new S('Location'));
             break;
         case 'commentEdit':
             // The URL to go back too;
             $objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
             // Do the form, make it happen;
             $this->setMethod(new S('POST'))->setFieldset(new S(TEXTS_EDIT_COMMENT))->setAJAXEnabledForm(new B(FALSE))->setRedirect($objURLToGoBack)->setSQLAction(new S('update'))->setTableName(self::$objCommentsTable)->setUpdateId($_GET[ADMIN_ACTION_ID])->setUpdateField(self::$objCommentsTableFId)->setName($objFormToRender)->setInputType(new S('submit'))->setValue(new S(TEXTS_EDIT_COMMENT))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setName(self::$objCommentsTableFApproved)->setLabel(new S(TEXTS_COMMENT_APPROVED))->setContainerDiv(new B(TRUE))->setInputType(new S('option'))->setName(new S('no'))->setValue(new S('N'))->setLabel(new S(TEXTS_CAN_COMMENT_NO))->setInputType(new S('option'))->setName(new S('yes'))->setValue(new S('Y'))->setLabel(new S(TEXTS_CAN_COMMENT_YES))->setInputType(new S('textarea'))->setName(self::$objCommentsTableFComment)->setLabel(new S(TEXTS_COMMENT))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
             break;
         case 'commentErase':
             // 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::$objCommentsTable)->doToken('%condition', new S('%objCommentsTableFId = "%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 'textCategoryCreate':
             // 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'));
             }
             // Do some work;
             if ($this->checkPOST(new S('add_category_submit'))->toBoolean() == TRUE) {
                 // Set some requirements;
                 $objFormHappened = new B(FALSE);
                 if ($this->getPOST(new S('add_category'))->toLength()->toInt() == 0) {
                     // Check for empty group name, and error on it;
                     $this->setErrorOnInput(new S('add_category'), new S(TEXTS_CATEGORY_NAME_CANNOT_BE_EMPTY));
                     // Set to memory;
                     $objFormHappened->switchType();
                 } else {
                     if (self::$objMPTT->mpttCheckIfNodeExists($this->getPOST(new S('add_category')))->toBoolean() == TRUE) {
                         // Check to see if the group exists;
                         $this->setErrorOnInput(new S('add_category'), new S(TEXTS_CATEGORY_ALREADY_EXISTS));
                         // Set to memory;
                         $objFormHappened->switchType();
                     }
                 }
                 // Get AJAX;
                 $this->getAjaxErrors();
                 if ($objFormHappened->toBoolean() == FALSE) {
                     // Remember if we should add it as a brother or child;
                     $objAddNodeAS = NULL;
                     switch ($this->getPOST(new S('add_category_as_what'))) {
                         case TEXTS_CATEGORY_CHILD:
                             $objAddNodeAS = new S((string) MPTT::FIRST_CHILD);
                             break;
                         case TEXTS_CATEGORY_LAST_CHILD:
                             $objAddNodeAS = new S((string) MPTT::LAST_CHILD);
                             break;
                         case TEXTS_CATEGORY_BROTHER:
                             $objAddNodeAS = new S((string) MPTT::PREVIOUS_BROTHER);
                             break;
                         case TEXTS_CATEGORY_NEXT_BROTHER:
                             $objAddNodeAS = new S((string) MPTT::NEXT_BROTHER);
                             break;
                     }
                     // Add the node;
                     self::$objMPTT->mpttAddNode($this->getPOST(new S('add_category')), $this->getPOST(new S('add_category_parent_or_bro')), $objAddNodeAS);
                     // Redirect back;
                     $this->setHeaderKey($objURLToGoBack, new S('Location'));
                 }
开发者ID:ajbm6,项目名称:raphpframework,代码行数:67,代码来源:00_Texts.php


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