本文整理汇总了PHP中S::appendString方法的典型用法代码示例。如果您正苦于以下问题:PHP S::appendString方法的具体用法?PHP S::appendString怎么用?PHP S::appendString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类S
的用法示例。
在下文中一共展示了S::appendString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderBackendPage
/**
* 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 renderBackendPage(S $objPageToRender)
{
// Get a specific CSS file for this controller ...
TPL::manageCSS(new FilePath($this->getPathToSkinCSS()->toRelativePath() . $objPageToRender . CSS_EXTENSION), $objPageToRender);
// Do pagination ...
if (isset($_GET[ADMIN_PAGINATION])) {
$objLowerLimit = (int) $_GET[ADMIN_PAGINATION]->toString() * 10 - 10;
$objUpperLimit = 10;
} else {
$objLowerLimit = 0;
$objUpperLimit = 10;
}
// Do a switch on the rendered page ...
switch ($objPageToRender) {
case 'manageArticles':
// Check if there's an action to take;
if (isset($_GET[ADMIN_ACTION])) {
// Do a switch ...
switch ($_GET[ADMIN_ACTION]) {
case ADMIN_ACTION_EDIT:
$this->renderForm(new S('articleEdit'));
break;
case ADMIN_ACTION_ERASE:
$this->renderForm(new S('articleErase'));
break;
}
} else {
// Redirect to DescByPublished ...
if (!isset($_GET[ADMIN_ACTION_SORT])) {
$this->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_ACTION_SORT)), new A(array('DescByPublished'))), new S('Location'));
}
// Set some requirements ...
$objGetCondition = new S();
if (isset($_GET[ADMIN_ACTION_BY])) {
// Do a switch ...
switch ($_GET[ADMIN_ACTION_BY]) {
case ARTICLES_SEARCH_TITLE:
$objGetCondition->appendString(_SP)->appendString('WHERE %objArticleTableFTitle');
break;
case ARTICLES_SEARCH_CONTENT:
$objGetCondition->appendString(_SP)->appendString('WHERE %objArticleTableFContent');
break;
case ARTICLES_SEARCH_TAGS:
$objGetCondition->appendString(_SP)->appendString('WHERE %objArticleTableFTags');
break;
case ARTICLES_SEARCH_EXCERPT:
$objGetCondition->appendString(_SP)->appendString('WHERE %objArticleTableFExcerpt');
break;
case ARTICLES_SEARCH_CATEGORY:
$objGetCondition->appendString('AS t1 INNER JOIN %objCategoryTable AS t2
ON t1.%objArticleTableFCategoryId = t2.%objCategoryTableFId
WHERE %objCategoryTableFName');
break;
}
// Add LIKE searching ...
$objGetCondition->appendString(_SP)->appendString('LIKE "%%Search%"')->doToken('%Search', $_GET[ADMIN_ACTION_SEARCH]);
// Get the count ...
$objSearchCount = $this->getArticleCount($objGetCondition);
}
// Do a sorting, before anything else;
if (isset($_GET[ADMIN_ACTION_SORT])) {
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByTitle':
case 'DescByTitle':
// Make the ordered condition;
$objGetCondition->appendString(_SP)->appendString('ORDER BY %objArticleTableFTitle');
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByTitle':
$objGetCondition->appendString(_SP)->appendString('ASC');
break;
case 'DescByTitle':
$objGetCondition->appendString(_SP)->appendString('DESC');
break;
}
break;
case 'AscByPublished':
case 'DescByPublished':
// Make the ordered condition;
$objGetCondition->appendString(_SP)->appendString('ORDER BY %objArticleTableFDatePublished');
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
//.........这里部分代码省略.........
示例2: renderBackendPage
/**
* 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 renderBackendPage(S $objPageToRender)
{
# Get a specific CSS file for this controller ...
TPL::manageCSS(new FilePath($this->getPathToSkinCSS()->toRelativePath() . $objPageToRender . CSS_EXTENSION), $objPageToRender);
# Do pagination ...
if (isset($_GET[ADMIN_PAGINATION])) {
$objLowerLimit = (int) $_GET[ADMIN_PAGINATION]->toString() * 10 - 10;
$objUpperLimit = 10;
} else {
$objLowerLimit = 0;
$objUpperLimit = 10;
}
// Do a switch on the rendered page ...
switch ($objPageToRender) {
case 'manageMessages':
// Set some predefines;
$objGetCondition = new S();
// Check if there's an action to take;
if (isset($_GET[ADMIN_ACTION])) {
// Switch between actions;
switch ($_GET[ADMIN_ACTION]) {
case ADMIN_ACTION_VIEW:
// Set the template file ...
$tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'viewMessage.tp');
TPL::tpSet($_GET[ADMIN_ACTION_ID], new S('objGETId'), $tpF);
TPL::tpSet($this, new S('CNT'), $tpF);
TPL::tpExe($tpF);
// Do the form, make it happen ...
$this->renderForm(new S('messageOperations'));
$this->renderForm(new S('messageSend'));
break;
case ADMIN_ACTION_ERASE:
$this->renderForm(new S('messageErase'));
break;
}
} else {
if (!isset($_GET[ADMIN_ACTION_SORT])) {
$this->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_ACTION_SORT)), new A(array('DescByReceived'))), new S('Location'));
}
// Set some requirements;
$objGetCondition = new S();
// Check if there's an action to take;
if (isset($_GET[ADMIN_ACTION_SORT])) {
// Switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByReceived':
case 'DescByReceived':
// Set some requirements;
$objGetCondition->appendString(_SP)->appendString('ORDER BY %objContactTableFReceived');
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByReceived':
$objGetCondEFEFEFition->appendString(_SP)->appendString('ASC');
break;
case 'DescByReceived':
$objGetCondition->appendString(_SP)->appendString('DESC');
break;
}
break;
case 'AscByLastEdited':
case 'DescByLastEdited':
// Set some requirements;
$objGetCondition->appendString(_SP)->appendString('ORDER BY %objContactTableFLastEdited');
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByLastEdited':
$objGetCondition->appendString(_SP)->appendString('ASC');
break;
case 'DescByLastEdited':
$objGetCondition->appendString(_SP)->appendString('DESC');
break;
}
break;
case 'AscBySubject':
case 'DescBySubject':
// Set some requirements;
$objGetCondition->appendString('AS t1 INNER JOIN %objContactSubjectTable AS t2
ON t1.%objContactTableFSubjectId = t2.%objContactSubjectFId
ORDER BY %objContactSubjectFTitle');
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscBySubject':
$objGetCondition->appendString(_SP)->appendString('ASC');
//.........这里部分代码省略.........
示例3: renderBackendPage
/**
* 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 renderBackendPage(S $objPageToRender)
{
// Get a specific CSS file for this controller ...
TPL::manageCSS(new FilePath($this->getPathToSkinCSS()->toRelativePath() . $objPageToRender . CSS_EXTENSION), $objPageToRender);
// Do pagination ...
if (isset($_GET[ADMIN_PAGINATION])) {
$objLowerLimit = (int) $_GET[ADMIN_PAGINATION]->toString() * 10 - 10;
$objUpperLimit = 10;
} else {
$objLowerLimit = 0;
$objUpperLimit = 10;
}
// Do a switch on the rendered page ...
switch ($objPageToRender) {
case 'manageConfiguration':
if (isset($_GET[ADMIN_ACTION])) {
$this->renderForm($_GET[ADMIN_ACTION]);
} else {
$this->renderForm(new S('configurationEdit'));
}
break;
case 'manageCountries':
// Do some work;
if (isset($_GET[ADMIN_ACTION])) {
// Do a switch;
switch ($_GET[ADMIN_ACTION]) {
case ADMIN_ACTION_EDIT:
$this->renderForm(new S('countryEdit'));
break;
case ADMIN_ACTION_ERASE:
$this->renderForm(new S('countryErase'));
break;
}
} else {
// Set some requirements ...
$objGetCondition = new S();
// Do a sorting beforehand;
if (isset($_GET[ADMIN_ACTION_SORT])) {
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByName':
case 'DescByName':
$objGetCondition->appendString(_SP)->appendString('ORDER BY %objSettingsCountryTableFName');
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByName':
$objGetCondition->appendString(_SP)->appendString('ASC');
break;
case 'DescByName':
$objGetCondition->appendString(_SP)->appendString('DESC');
break;
}
// Break out ...
break;
}
}
// Add some LIMITs
$objGetCondition->appendString(_SP)->appendString('LIMIT %LowerLimit, %UpperLimit')->doToken('%LowerLimit', $objLowerLimit)->doToken('%UpperLimit', $objUpperLimit);
// Set some requirements ...
$objCountries = $this->getCountries($objGetCondition);
$objCountriesCount = $this->getCountryCount();
// Set the template file ...
$tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'manageCountries.tp');
TPL::tpSet($objCountries, new S('articleTable'), $tpF);
TPL::tpExe($tpF);
// Do some pagination;
if ($objCountriesCount->toInt() > 10) {
self::$objAdministration->setPagination($objCountriesCount);
}
// Do the form, make it happen;
$this->renderForm(new S('countryCreate'));
}
// Break out ...
break;
case 'manageErrorPages':
// Do some work;
if (isset($_GET[ADMIN_ACTION])) {
// Do a switch;
switch ($_GET[ADMIN_ACTION]) {
case ADMIN_ACTION_EDIT:
$this->renderForm(new S('errorPageEdit'));
break;
case ADMIN_ACTION_ERASE:
//.........这里部分代码省略.........
示例4: renderBackendPage
/**
* 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 renderBackendPage(S $objPageToRender)
{
// Get a specific CSS file for this controller ...
TPL::manageCSS(new FilePath($this->getPathToSkinCSS()->toRelativePath() . $objPageToRender . CSS_EXTENSION), $objPageToRender);
// Do pagination ...
if (isset($_GET[ADMIN_PAGINATION])) {
$objLowerLimit = (int) $_GET[ADMIN_PAGINATION]->toString() * 10 - 10;
$objUpperLimit = 10;
} else {
$objLowerLimit = 0;
$objUpperLimit = 10;
}
// Do a switch on the rendered page ...
switch ($objPageToRender) {
case 'manageNewsletter':
// Do some work;
if (isset($_GET[ADMIN_ACTION])) {
// Do a switch;
switch ($_GET[ADMIN_ACTION]) {
case ADMIN_ACTION_EDIT:
$this->renderForm(new S('newsletterEdit'));
break;
case ADMIN_ACTION_ERASE:
$this->renderForm(new S('newsletterErase'));
break;
}
} else {
// Redirect to DescBySubscribed ...
if (!isset($_GET[ADMIN_ACTION_SORT])) {
$this->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_ACTION_SORT)), new A(array('DescBySubscribed'))), new S('Location'));
}
// Set some requirements ...
$objGetCondition = new S();
// Check for sorting ...
if (isset($_GET[ADMIN_ACTION_BY])) {
// Do a switch ...
switch ($_GET[ADMIN_ACTION_BY]) {
}
// Add LIKE searching ...
$objGetCondition->appendString(_SP)->appendString('LIKE "%%Search%"')->doToken('%Search', $_GET[ADMIN_ACTION_SEARCH]);
// Get the count, on SQL ...
$objSearchCount = $this->getSubscriberCount($objGetCondition);
}
// Do a sorting beforehand;
if (isset($_GET[ADMIN_ACTION_SORT])) {
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByEmail':
case 'DescByEmail':
// Make the ordered condition;
$objGetCondition->appendString(_SP)->appendString('ORDER BY %objLetterTableFEML');
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByEmail':
$objGetCondition->appendString(_SP)->appendString('ASC');
break;
case 'DescByEmail':
$objGetCondition->appendString(_SP)->appendString('DESC');
break;
}
// Break out ...
break;
case 'AscByFirstName':
case 'DescByFirstName':
// Make the ordered condition;
$objGetCondition->appendString(_SP)->appendString('ORDER BY %objLetterTableFFirstName');
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByFirstName':
$objGetCondition->appendString(_SP)->appendString('ASC');
break;
case 'DescByFirstName':
$objGetCondition->appendString(_SP)->appendString('DESC');
break;
}
// Break out ...
break;
case 'AscByLastName':
case 'DescByLastName':
// Make the ordered condition;
$objGetCondition->appendString(_SP)->appendString('ORDER BY %objLetterTableFLastName');
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
//.........这里部分代码省略.........
示例5: renderBackendPage
/**
* 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 renderBackendPage(S $objPageToRender)
{
// Get a specific CSS file for this controller ...
TPL::manageCSS(new FilePath($this->getPathToSkinCSS()->toRelativePath() . $objPageToRender . CSS_EXTENSION), $objPageToRender);
// Do pagination ...
if (isset($_GET[ADMIN_PAGINATION])) {
$objLowerLimit = (int) $_GET[ADMIN_PAGINATION]->toString() * 10 - 10;
$objUpperLimit = 10;
} else {
$objLowerLimit = 0;
$objUpperLimit = 10;
}
// Do a switch on the rendered page ...
switch ($objPageToRender) {
case 'manageImages':
// Make an IF;
if (isset($_GET[PRODUCTS_ACTION_IMAGE])) {
// Do a switch ...
switch ($_GET[PRODUCTS_ACTION_IMAGE]) {
case ADMIN_ACTION_EDIT:
$this->renderForm(new S('imageEdit'));
break;
case ADMIN_ACTION_ERASE:
$this->renderForm(new S('imageErase'));
break;
}
} else {
// Set some requirements ...
$objGetCondition = new S();
// Do a sorting beforehand;
if (isset($_GET[ADMIN_ACTION_SORT])) {
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByImage':
case 'DescByImage':
$objGetCondition->appendString(_SP)->appendString('ORDER BY %objProductsIMGTableFURL');
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByImage':
$objGetCondition->appendString(_SP)->appendString('ASC');
break;
case 'DescByImage':
$objGetCondition->appendString(_SP)->appendString('DESC');
break;
}
// Break out ...
break;
case 'AscByTitle':
case 'DescByTitle':
$objGetCondition->appendString(_SP)->appendString('ORDER BY %objProductsIMGTableFTitle');
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByTitle':
$objGetCondition->appendString(_SP)->appendString('ASC');
break;
case 'DescByTitle':
$objGetCondition->appendString(_SP)->appendString('DESC');
break;
}
// Break out ...
break;
}
} else {
// Set some requirements ...
$objGetCondition->appendString(_SP)->appendString('ORDER BY %objProductsIMGTableFId DESC');
}
// Add some LIMITs
$objGetCondition->appendString(_SP)->appendString('LIMIT %LowerLimit, %UpperLimit')->doToken('%LowerLimit', $objLowerLimit)->doToken('%UpperLimit', $objUpperLimit);
// Set some requirements ...
$objImageTable = $this->getImagesByProductId($_GET[ADMIN_ACTION_ID], $objGetCondition);
$objImageTableCount = $this->getImageCountByProductId($_GET[ADMIN_ACTION_ID]);
// Set the template file ...
$tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'manageImages.tp');
TPL::tpSet($objImageTable, new S('imageTable'), $tpF);
TPL::tpSet($this, new S('thisObj'), $tpF);
TPL::tpExe($tpF);
// Do some pagination;
if ($objImageTableCount->toInt() > 10) {
self::$objAdministration->setPagination($objImageTableCount);
}
// Do the form, make it happen;
$this->renderForm(new S('imageCreate'));
}
//.........这里部分代码省略.........
示例6: getJSSHeader
/**
* Will return the JSS header, parsing some .tp files for tokens to be replaced. This method is an internal method used by core
* developers to add the specific <script type='text/javascript' src='...'> to the header section of our DOM.
*
* @return S Will return the JSS header for the current page
* @author Catalin Z. Alexandru <catalin.zamfir@raphpframework.ro>
* @copyright Under the terms of the GNU General Public License v3
* @version $Id: 10_TPL.php 315 2009-10-11 07:11:31Z catalin.zamfir $
* @since Version 1.0
* @access private
* @static
* @final
*/
private static final function getJSSHeader()
{
$jssHeaderString = new S();
$jssReplaceString = new S('[%SCRIPT_JS_SRC%]');
$jssPureString = new FileContent(FORM_TP_DIR . _S . 'frm_web_header_js.tp');
foreach (self::$objPageJSS as $k => $v) {
$jssHeaderString->appendString(str_replace($jssReplaceString->toString(), self::$objPageJSS[$k], $jssPureString->toString()));
}
// Do return ...
return $jssHeaderString;
}
示例7: renderBackendPage
/**
* 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 renderBackendPage(S $objPageToRender)
{
// Get a specific CSS file for this controller ...
TPL::manageCSS(new FilePath($this->getPathToSkinCSS()->toRelativePath() . $objPageToRender . CSS_EXTENSION), $objPageToRender);
// Do pagination ...
if (isset($_GET[ADMIN_PAGINATION])) {
$objLowerLimit = (int) $_GET[ADMIN_PAGINATION]->toString() * 10 - 10;
$objUpperLimit = 10;
} else {
$objLowerLimit = 0;
$objUpperLimit = 10;
}
// Do a switch on the rendered page ...
switch ($objPageToRender) {
case 'welcomePage':
// Set the template file ...
$tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'welcomePage.tp');
TPL::tpSet(self::$objAdministration->getWidget(NULL), new S('objWidgets'), $tpF);
TPL::tpExe($tpF);
break;
case 'manageUsers':
// Do specific actions, based on _GET parameters;
if (isset($_GET[ADMIN_ACTION])) {
// Switch ...
switch ($_GET[ADMIN_ACTION]) {
case ADMIN_ACTION_EDIT:
$this->renderForm(new S('userEdit'));
break;
case ADMIN_ACTION_ERASE:
$this->renderForm(new S('userErase'));
break;
}
} else {
// Show them ordered by DESC;
if (!isset($_GET[ADMIN_ACTION_SORT])) {
$this->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_ACTION_SORT)), new A(array('DescByRegistered'))), new S('Location'));
}
// Set some requirements;
$objGetCondition = new S();
if (isset($_GET[ADMIN_ACTION_BY])) {
// Do a switch ...
switch ($_GET[ADMIN_ACTION_BY]) {
case AUTHENTICATION_PROFILE_USERNAME:
$objGetCondition->appendString('WHERE %objAuthUsersTableFUName');
break;
case AUTHENTICATION_PROFILE_EMAIL:
$objGetCondition->appendString('WHERE %objAuthUsersTableFEML');
break;
case AUTHENTICATION_PROFILE_GROUP:
$objGetCondition->appendString('AS t1 LEFT JOIN %objAuthGroupTable
AS t2 ON t1.%objAuthUsersTableFUGId = t2.%objAuthGroupTableFId
WHERE t2.%objAuthGroupTableFName');
break;
}
// Add LIKE searching ...
$objGetCondition->appendString(_SP)->appendString('LIKE "%%Search%"')->doToken('%Search', $_GET[ADMIN_ACTION_SEARCH]);
}
if (isset($_GET[ADMIN_ACTION_SORT])) {
// Switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByUsername':
case 'DescByUsername':
// Set the order ...
$objGetCondition->appendString(_SP)->appendString('ORDER BY %objAuthUsersTableFUName');
// Switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByUsername':
$objGetCondition->appendString(_SP)->appendString('ASC');
break;
case 'DescByUsername':
$objGetCondition->appendString(_SP)->appendString('DESC');
break;
}
break;
case 'AscByEMail':
case 'DescByEMail':
// Set the order ...
$objGetCondition->appendString(_SP)->appendString('ORDER BY %objAuthUsersTableFEML');
// Switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByEMail':
$objGetCondition->appendString(_SP)->appendString('ASC');
break;
//.........这里部分代码省略.........
示例8: doMAIL
/**
* Will send the email, at the specified address, using the specified subject and content;
*
* This method will send out the given email and subject, to the given address, while decoding the content from entities; You,
* as the user, SHOULD ALWAYS remember, that the content gets decoded in this method, thus allowing you to work with your
* content where you've called it, without modifying it;
*
* @param S $objMAILTo The email to send it to;
* @param S $objMAILSubject The subject to set;
* @param S $objMAILContent And the content;
* @todo CLEAN THIS URGENTLY! ...
*/
public function doMAIL(S $objMAILTo, S $objMAILSubject, S $objMAILContent)
{
// First of ALL, get a CLONE ...
$objMAILClone = clone $objMAILContent;
$objMAILClone = $objMAILClone->entityDecode(ENT_QUOTES)->stripTags();
// #0: proper MULTIPART;
$objMAILContent->prependString(new S(_N_))->prependString(_S(self::MAIL_HEADER_CONTENT_ENCODING_SEVENBIT . _N_))->prependString(_S(self::MAIL_HEADER_CONTENT_TYPE_HTML . _N_))->prependString(_S(self::MAIL_HEADER_PHP_ALTERNATIVE . _N_)->doToken('%s', self::$objHASHId))->prependString(_S(_N_))->prependString(_S($objMAILClone . _N_))->prependString(_S(_N_))->prependString(_S(self::MAIL_HEADER_CONTENT_ENCODING_SEVENBIT . _N_))->prependString(_S(self::MAIL_HEADER_CONTENT_TYPE_PLAIN . _N_))->prependString(_S(self::MAIL_HEADER_PHP_ALTERNATIVE . _N_)->doToken('%s', self::$objHASHId))->prependString(_S(_N_))->prependString(_S(self::MAIL_HEADER_MULTIPART_ALTERNATIVE . _N_)->doToken('%s', self::$objHASHId))->prependString(_S(self::MAIL_HEADER_PHP_MIXED . _N_)->doToken('%s', self::$objHASHId));
// #4: ... end PLAIN and HTML ...
$objMAILContent->appendString(_S(_N_))->appendString(_S(self::MAIL_HEADER_PHP_ALTERNATIVE_END . _N_)->doToken('%s', self::$objHASHId));
// #5: ... attachments;
foreach (self::$objEMLAttachment as $k => $v) {
// #5.1
$objMAILContent->appendString(_S(self::MAIL_HEADER_PHP_MIXED . _N_)->doToken('%s', self::$objHASHId))->appendString(_S(self::MAIL_HEADER_ATTACHMENT_TYPE_NAME . _N_)->doToken('%t', $v['attachment_type'])->doToken('%n', $v['attachment_name']))->appendString(_S(self::MAIL_HEADER_ENCODING_BASE64 . _N_))->appendString(_S(self::MAIL_HEADER_DISPOSITION_ATTACHMENT . _N_))->appendString(_S(_N_))->appendString($v['attachment_base64'])->appendString(_S(self::MAIL_HEADER_PHP_MIXED . _N_)->doToken('%s', self::$objHASHId));
}
// Finish ...
$objMAILContent->appendString(_S(_N_))->appendString(_S(self::MAIL_HEADER_PHP_MIXED_END)->doToken('%s', self::$objHASHId));
// Go ... everyhing IS ok and life's grand ...
MAIL($objMAILTo, $objMAILSubject, $objMAILContent->entityDecode(ENT_QUOTES), self::$objFromHeader . self::$objReceiptTo . self::$objReplyTo . self::$objMIMEHeader . self::$objTypeHTML);
}
示例9: setSQLOperationsOnForm
/**
* Will execute necessary SQL operations on the current form ...
*
* This method, setSQLOperationsOnForm, you don't need to know the internal workings of it. This is because, as you can see
* it is a private method, and thus, it's used internally by the class, to achieve it's goals of execution. Just pass on
* and read any other 'public' or 'protected' method out there ...
*
* @return object The current object instance;
*/
private static function setSQLOperationsOnForm()
{
if (isset(self::$objFormDataContainer['table_name'])) {
if (isset(self::$objFormDataContainer['table_name']) && isset(self::$objUpdateWhere)) {
$q = new S('SELECT * FROM %table WHERE %condition LIMIT 1');
$q->doToken('%table', self::$objFormDataContainer['table_name']);
$q->doToken('%condition', self::$objUpdateWhere);
if (self::getQuery($q)->doCount()->toInt() == 0) {
self::$objFormDataContainer['update_or_insert'] = new S('insert');
}
}
// Do update;
if (isset(self::$objFormDataContainer['update_or_insert']) && self::$objFormDataContainer['update_or_insert'] == new S('update')) {
// Check to see if update_id is set. We can't update on something that doesn't exist!
if (isset(self::$objUpdateWhere)) {
// For each _SESSION['POST'] key, do an update ...
foreach ($_SESSION['POST'] as $k => $v) {
if (in_array($k, self::$objUpdateTableFields->toArray())) {
$q = new S('UPDATE %table SET %who = "%what" WHERE %condition');
$q->doToken('%table', self::$objUpdateTableName)->doToken('%who', $k)->doToken('%what', $v)->doToken('%condition', self::$objUpdateWhere);
self::getQuery($q);
}
}
// Do additional SQLs ...
foreach (self::$objOtherSQLData as $k => $v) {
$q = new S('UPDATE %table SET %who = "%what" WHERE %condition');
$q->doToken('%table', self::$objUpdateTableName)->doToken('%who', $k)->doToken('%what', $v)->doToken('%condition', self::$objUpdateWhere);
self::getQuery($q);
}
}
} else {
if (isset(self::$objFormDataContainer['update_or_insert']) && self::$objFormDataContainer['update_or_insert'] == new S('insert')) {
if (isset(self::$objFormDataContainer['table_save_into'])) {
$insertTableArray = self::$objFormDataContainer['table_save_into'];
$insertTable = self::$objFormDataContainer['table_save_into']->toValues();
$insertTableCount = count($insertTable);
for ($i = 0; $i < $insertTableCount; ++$i) {
foreach ($_SESSION['POST'] as $k => $v) {
if (isset($insertTableArray[$k]) && isset($insertTable[$i]) && $insertTableArray[$k] == $insertTable[$i]) {
$detectedMULTIPLEInputs[$insertTable[$i]][] = $k;
}
}
}
foreach ($detectedMULTIPLEInputs as $k => $v) {
$a = new A();
$q = new S('INSERT INTO %table SET' . _SP);
$q->doToken('%table', $k);
$detectedMULTIPLEInputs[$k] = array_unique($v);
$tableFields = self::getFieldsFromTable(new S($k));
foreach ($_SESSION['POST'] as $kv => $vv) {
$r = new S('%who = "%what"');
if (in_array($kv, $tableFields->toArray())) {
$a[] = $r->doToken('%who', $kv)->doToken('%what', $vv);
}
}
foreach (self::$objOtherSQLData as $k => $v) {
$r = new S('%who = "%what"');
if (in_array($k, $tableFields->toArray())) {
$a[] = $r->doToken('%who', $k)->doToken('%what', $v);
}
}
$q->appendString(implode(', ', $a->toArray()));
self::getQuery($q);
}
// Do for the native table ...
if (isset(self::$objFormDataContainer['table_name'])) {
$a = new A();
$q = new S('INSERT INTO %table SET' . _SP);
$q->doToken('%table', self::$objFormDataContainer['table_name']);
$tableFields = self::getFieldsFromTable(self::$objFormDataContainer['table_name']);
foreach ($_SESSION['POST'] as $k => $v) {
if (in_array($k, $tableFields->toArray())) {
$r = new S('%who = "%what"');
$a[] = $r->doToken('%who', $k)->doToken('%what', $v);
}
}
foreach (self::$objOtherSQLData as $k => $v) {
$r = new S('%who = "%what"');
if (in_array($k, $tableFields->toArray())) {
$a[] = $r->doToken('%who', $k)->doToken('%what', $v);
}
}
$q->appendString(implode(', ', $a->toArray()));
self::getQuery($q);
}
} else {
$a = new A();
$q = new S('INSERT INTO %table SET' . _SP);
$q->doToken('%table', self::$objFormDataContainer['table_name']);
$tableFields = self::getFieldsFromTable(self::$objFormDataContainer['table_name']);
foreach ($_SESSION['POST'] as $k => $v) {
//.........这里部分代码省略.........
示例10: renderBackendPage
/**
* 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 renderBackendPage(S $objPageToRender)
{
// Get a specific CSS file for this controller ...
TPL::manageCSS(new FilePath($this->getPathToSkinCSS()->toRelativePath() . $objPageToRender . CSS_EXTENSION), $objPageToRender);
// Do pagination ...
if (isset($_GET[ADMIN_PAGINATION])) {
$objLowerLimit = (int) $_GET[ADMIN_PAGINATION]->toString() * 10 - 10;
$objUpperLimit = 10;
} else {
$objLowerLimit = 0;
$objUpperLimit = 10;
}
// Do a switch on the rendered page ...
switch ($objPageToRender) {
case 'manageLyrics':
// Do some work;
if (isset($_GET[ADMIN_ACTION])) {
// Do a switch;
switch ($_GET[ADMIN_ACTION]) {
case ADMIN_ACTION_EDIT:
$this->renderForm(new S('lyricEdit'));
break;
case ADMIN_ACTION_ERASE:
$this->renderForm(new S('lyricErase'));
break;
}
} else {
// Redirect to DescByDateAdded ...
if (!isset($_GET[ADMIN_ACTION_SORT])) {
$this->setHeaderKey(URL::rewriteURL(new A(array(ADMIN_ACTION_SORT)), new A(array('DescByDateAdded'))), new S('Location'));
}
// Set some requirements ...
$objGetCondition = new S();
// Do a sorting beforehand;
if (isset($_GET[ADMIN_ACTION_SORT])) {
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByTitle':
case 'DescByTitle':
$objGetCondition->appendString(_SP)->appendString('ORDER BY %objLyricsTableFTitle');
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByTitle':
$objGetCondition->appendString(_SP)->appendString('ASC');
break;
case 'DescByTitle':
$objGetCondition->appendString(_SP)->appendString('DESC');
break;
}
// BK;
break;
case 'AscByArtist':
case 'DescByArtist':
$objGetCondition->appendString(_SP)->appendString('ORDER BY %objLyricsTableFArtist');
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByArtist':
$objGetCondition->appendString(_SP)->appendString('ASC');
break;
case 'DescByArtist':
$objGetCondition->appendString(_SP)->appendString('DESC');
break;
}
// BK;
break;
case 'AscByAlbum':
case 'DescByAlbum':
$objGetCondition->appendString(_SP)->appendString('ORDER BY %objLyricsTableFAlbum');
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByAlbum':
$objGetCondition->appendString(_SP)->appendString('ASC');
break;
case 'DescByAlbum':
$objGetCondition->appendString(_SP)->appendString('DESC');
break;
}
// BK;
break;
case 'AscByDateAdded':
case 'DescByDateAdded':
$objGetCondition->appendString(_SP)->appendString('ORDER BY %objLyricsTableFDateAdded');
// Do a switch ...
//.........这里部分代码省略.........