本文整理汇总了PHP中TPL::tpExe方法的典型用法代码示例。如果您正苦于以下问题:PHP TPL::tpExe方法的具体用法?PHP TPL::tpExe怎么用?PHP TPL::tpExe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPL
的用法示例。
在下文中一共展示了TPL::tpExe方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderBackendPage
//.........这里部分代码省略.........
case 'DescByCategory':
$objGetCondition->appendString(_SP)->appendString('DESC');
break;
}
break;
}
}
// Add some LIMITs
$objGetCondition->appendString(_SP)->appendString('LIMIT %LowerLimit, %UpperLimit')->doToken('%LowerLimit', $objLowerLimit)->doToken('%UpperLimit', $objUpperLimit);
// Get based on SQL condtion ...
$objArticleTable = $this->getArticles($objGetCondition);
if (isset($_GET[ADMIN_ACTION_BY])) {
$objArticleTableCount = $objSearchCount;
} else {
$objArticleTableCount = $this->getArticleCount();
}
// Fix pagination when count is LESS than 10;
if (isset($_GET[ADMIN_ACTION_BY]) && isset($_GET[ADMIN_PAGINATION])) {
if ($objArticleTableCount->toInt() < 10) {
// Remove paging ... & redirect to proper ...
TPL::setHeaderKey(URL::rewriteURL(new A(array(ADMIN_PAGINATION))), new S('Location'));
} else {
if (CEIL($objArticleTableCount->toInt() / 10) < (int) $_GET[ADMIN_PAGINATION]->toString()) {
// Redirect to proper ...
TPL::setHeaderKey(URL::rewriteURL(new A(array(ADMIN_PAGINATION)), new A(array(CEIL($objArticleTableCount->toInt() / 10)))), new S('Location'));
}
}
}
// Set the template file ...
$tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'manageArticles.tp');
TPL::tpSet($objArticleTable, new S('articleTable'), $tpF);
TPL::tpSet($this, new S('ART'), $tpF);
TPL::tpSet($this->STG, new S('STG'), $tpF);
TPL::tpExe($tpF);
// Do pagination ...
if ($objArticleTableCount->toInt() > 10) {
self::$objAdministration->setPagination($objArticleTableCount);
}
// Do the form, make it happen;
$this->renderForm(new S('articleSearch'));
$this->renderForm(new S('articleCreate'));
}
// BK;
break;
case 'manageCategories':
// Add some requirements;
TPL::manageJSS(new FilePath($this->getPathToSkinJSS()->toRelativePath() . 'manageCategories.js'), new S('manageCategories'));
// 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('categoryEdit'));
break;
case ADMIN_ACTION_ERASE:
$this->renderForm(new S('categoryErase'));
break;
case ADMIN_ACTION_MOVE:
$this->renderForm(new S('categoryMove'));
break;
}
} else {
// Set some requirements ...
$objGetCondition = new S();
// Do a sorting, before anything else;
if (isset($_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
//.........这里部分代码省略.........
break;
case 'DescByLastName':
$objGetCondition->appendString(_SP)->appendString('DESC');
break;
}
// Break out ...
break;
case 'AscBySubscribed':
case 'DescBySubscribed':
// Make the ordered condition;
$objGetCondition->appendString(_SP)->appendString('ORDER BY %objLetterTableFSubscribed');
// Do a switch ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscBySubscribed':
$objGetCondition->appendString(_SP)->appendString('ASC');
break;
case 'DescBySubscribed':
$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 ...
$objLetterTable = $this->getSubscribers($objGetCondition);
$objLetterTableCount = $this->getSubscriberCount();
// Set the template file ...
$tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'manageNewsletter.tp');
TPL::tpSet($objLetterTable, new S('newsletterTable'), $tpF);
TPL::tpSet($this->STG, new S('STG'), $tpF);
TPL::tpExe($tpF);
// Do some pagination;
if ($objLetterTableCount->toInt() > 10) {
self::$objAdministration->setPagination($objLetterTableCount);
}
// Do the form, make it happen;
$this->renderForm(new S('newsletterSearch'));
$this->renderForm(new S('newsletterCreate'));
}
// Break out ...
break;
case 'manageCategories':
// Add some requirements;
TPL::manageJSS(new FilePath($this->getPathToSkinJSS()->toRelativePath() . 'manageCategories.js'), new S('manageCategories'));
// 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('categoryEdit'));
break;
case ADMIN_ACTION_ERASE:
$this->renderForm(new S('categoryErase'));
break;
case ADMIN_ACTION_MOVE:
$this->renderForm(new S('categoryMove'));
break;
}
} else {
// Set some requirements ...
$objGetCondition = new S();
// Do a sorting, before anything else;
if (isset($_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: renderForm
//.........这里部分代码省略.........
if ($this->getPOST(self::$objAudioTableFAlbum)->toLength()->toInt() == 0) {
$this->setErrorOnInput(self::$objAudioTableFAlbum, new S(AUDIO_ALBUM_REQUIRED));
}
}
// Check & Get;
$this->getAjaxErrors();
// Do the form, make it happen;
$this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(AUDIO_ADD_AUDIO))->setSQLAction(new S('update'))->setTableName(self::$objAudioTable)->setUpdateId(new S('#nextTableAutoIncrement'))->setUpdateField(self::$objAudioTableFId)->setExtraUpdateData(self::$objAudioTableFUploaderId, $this->ATH->getCurrentUserInfoById(Authentication::$objAuthUsersTableFId))->setUploadDirectory(new S('audio/mp3/' . $objUPDirectory))->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);
if ($this->checkPOST(self::$objAudioTableFTitle)->toBoolean() == TRUE) {
$this->setRedirect($objURLToGoBack);
}
$this->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setValue(new S(AUDIO_ADD_AUDIO))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setName(self::$objAudioTableFApproved)->setLabel(new S(AUDIO_FILE_APPROVED))->setContainerDiv(new B(TRUE))->setInputType(new S('option'))->setName(new S('yes'))->setValue(new S('Y'))->setLabel(new S(AUDIO_FILE_APPROVED_YES))->setInputType(new S('option'))->setName(new S('no'))->setValue(new S('N'))->setLabel(new S(AUDIO_FILE_APPROVED_NO))->setInputType(new S('select'))->setName(self::$objAudioTableFCanComment)->setLabel(new S(AUDIO_CAN_COMMENT))->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('text'))->setName(self::$objAudioTableFTitle)->setLabel(new S(AUDIO_FILE_TITLE))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setName(self::$objAudioTableFCategoryId)->setLabel(new S(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('file'))->setName(self::$objAudioTableFFile)->setLabel(new S(AUDIO_FILE))->setContainerDiv(new B(TRUE))->setInputType(new S('file'))->setName(self::$objAudioTableFArtwork)->setLabel(new S(AUDIO_FILE_ARTWORK))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objAudioTableFArtist)->setLabel(new S(AUDIO_FILE_ARTIST))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objAudioTableFAlbum)->setLabel(new S(AUDIO_FILE_ALBUM))->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(self::$objAudioTableFLyrics)->setLabel(new S(AUDIO_FILE_LYRICS))->setTinyMCETextarea(new B(TRUE))->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(self::$objAudioTableFDescription)->setLabel(new S(AUDIO_FILE_DESCRIPTION))->setTinyMCETextarea(new B(TRUE))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
break;
case 'audioEdit':
// God send us our info ...
$tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'audioEditInfo.tp');
TPL::tpSet($this, new S('AUD'), $tpF);
TPL::tpExe($tpF);
// The URL to go back too;
$objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
$objUPDirectory = date('Y/m/d', (int) $this->getAudioFileInfoById($_GET[ADMIN_ACTION_ID], self::$objAudioTableFUploadedDate)->toString());
// Check & Get;
$this->getAjaxErrors();
// Do the form, make it happen;
$this->setMethod(new S('POST'))->setEnctype(new S('multipart/form-data'))->setFieldset(new S(AUDIO_EDIT_AUDIO))->setSQLAction(new S('update'))->setTableName(self::$objAudioTable)->setUpdateId($_GET[ADMIN_ACTION_ID])->setUpdateField(self::$objAudioTableFId)->setUploadDirectory(new S('audio/mp3/' . $objUPDirectory))->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($this->getAudioFileInfoById($_GET[ADMIN_ACTION_ID], self::$objAudioTableFUploadedDate))));
}
// Continue ...
$this->setName($objFormToRender)->setRedirect($objURLToGoBack)->setAJAXEnabledForm(new B(FALSE))->setInputType(new S('submit'))->setValue(new S(AUDIO_EDIT_AUDIO))->setInputInfoMessage($this->getHELP($objFormToRender))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setName(self::$objAudioTableFApproved)->setLabel(new S(AUDIO_FILE_APPROVED))->setContainerDiv(new B(TRUE))->setInputType(new S('option'))->setName(new S('yes'))->setValue(new S('Y'))->setLabel(new S(AUDIO_FILE_APPROVED_YES))->setInputType(new S('option'))->setName(new S('no'))->setValue(new S('N'))->setLabel(new S(AUDIO_FILE_APPROVED_NO))->setInputType(new S('select'))->setName(self::$objAudioTableFCanComment)->setLabel(new S(AUDIO_CAN_COMMENT))->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('text'))->setName(self::$objAudioTableFTitle)->setLabel(new S(AUDIO_FILE_TITLE))->setContainerDiv(new B(TRUE))->setInputType(new S('select'))->setName(self::$objAudioTableFCategoryId)->setLabel(new S(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('file'))->setName(self::$objAudioTableFFile)->setLabel(new S(AUDIO_FILE))->setFileController(new B(TRUE))->setContainerDiv(new B(TRUE))->setInputType(new S('file'))->setName(self::$objAudioTableFArtwork)->setLabel(new S(AUDIO_FILE_ARTWORK))->setFileController(new B(TRUE))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objAudioTableFArtist)->setLabel(new S(AUDIO_FILE_ARTIST))->setContainerDiv(new B(TRUE))->setInputType(new S('text'))->setName(self::$objAudioTableFAlbum)->setLabel(new S(AUDIO_FILE_ALBUM))->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(self::$objAudioTableFLyrics)->setLabel(new S(AUDIO_FILE_LYRICS))->setTinyMCETextarea(new B(TRUE))->setContainerDiv(new B(TRUE))->setInputType(new S('textarea'))->setName(self::$objAudioTableFDescription)->setLabel(new S(AUDIO_FILE_DESCRIPTION))->setTinyMCETextarea(new B(TRUE))->setContainerDiv(new B(TRUE))->setFormEndAndExecute(new B(TRUE));
break;
case 'audioErase':
// The URL to go back too;
$objURLToGoBack = URL::rewriteURL(new A(array(ADMIN_ACTION, ADMIN_ACTION_ID)));
$objUPDirectory = date('Y/m/d/', (int) $this->getAudioFileInfoById($_GET[ADMIN_ACTION_ID], self::$objAudioTableFUploadedDate)->toString());
if ($this->getCommentCount(_S('WHERE %objCommentsTableFAudioFileId = "%Id"')->doToken('%Id', $_GET[ADMIN_ACTION_ID]))->toInt() != 0) {
self::$objAdministration->setErrorMessage(new S(AUDIO_HAS_COMMENTS), $objURLToGoBack);
} else {
// Remove them files ...
示例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: tieALLRegisteredAdminInterfaces
/**
* Will tie in ALL registered administrator interfaces in the framework;
*
* This method will do a scan of all modules defined in the framework, and WILL do a CALL to each bonding method of those
* respective methods; For the Authentication and Administration module, proper code is implemented, because of the strict
* bonding between these two modules;
* @return void Will not return a thing, but probably error if something goes wrong;
*/
private function tieALLRegisteredAdminInterfaces()
{
// Set some predefined defaults, just to be sure we have something;
TPL::manageTTL(self::$objHeaderText);
TPL::switchTTL();
// Add the current page, or subpage to the <title> ...
TPL::manageTTL(isset($_GET[ADMIN_PAGE]) ? $_GET[ADMIN_PAGE] : new S());
TPL::manageTTL(isset($_GET[ADMIN_SUBPAGE]) ? $_GET[ADMIN_SUBPAGE] : new S());
// Do a for-each on ALL registered modules within' the framework;
$objRegisteredModules = $this->getRegisteredModules();
foreach ($objRegisteredModules as $k => $v) {
// IGNORE: Administration, because it's manually tied;
if ($this->getPathToModule()->toRelativePath() == $v['dir']->toString()) {
$this->tieInWithAdministration($this);
continue;
}
// IGNORE: Authentication, because it's manually tied;
if ($this->getObjectCLASS(self::$objAuthenticationMech) == $v['obj']) {
if (self::$objAuthenticationMech->checkCurrentUserZoneACL($this->getObjectCLASS(self::$objAuthenticationMech))->toBoolean() == TRUE) {
self::$objAuthenticationMech->tieInWithAdministration($this);
}
continue;
} else {
// Make the object, and store it;
$objMod = $this->activateModule(new FilePath($v['dir']), new B(TRUE));
$objMod->tieInWithAuthentication(self::$objAuthenticationMech);
if (self::$objAuthenticationMech->checkCurrentUserZoneACL($this->getObjectCLASS($objMod))->toBoolean() == TRUE) {
// Do the tie;
$objMod->tieInWithAdministration($this);
}
}
}
// Set some predefines;
if (self::$objMenuArray == NULL) {
self::$objMenuArray = new A();
}
if (self::$objSubMArray == NULL) {
self::$objSubMArray = new A();
}
// Set the script end;
self::setExeTime(new S('administration_end'));
// After we know all the details, execute the viewer whit these parameters;
$tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'administration.tp');
TPL::tpSet(new F(self::getExeTime(new S('administration_start'), new S('administration_end'))), new S('objExeTime'), $tpF);
TPL::tpSet(self::$objSwitcherLink, new S('objSwitcherLink'), $tpF);
TPL::tpSet(self::$objHeaderText, new S('objHeaderText'), $tpF);
TPL::tpSet(self::$objFooterText, new S('objFooterText'), $tpF);
TPL::tpSet(self::$objMenuArray, new S('objMenuArray'), $tpF);
TPL::tpSet(self::$objSubMArray, new S('objSubMArray'), $tpF);
TPL::tpSet(self::$objLogOutLink, new S('objLogOutLink'), $tpF);
TPL::tpExe($tpF);
}
示例9: renderBackendPage
//.........这里部分代码省略.........
// 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 ...
switch ($_GET[ADMIN_ACTION_SORT]) {
case 'AscByDateAdded':
$objGetCondition->appendString(_SP)->appendString('ASC');
break;
case 'DescByDateAdded':
$objGetCondition->appendString(_SP)->appendString('DESC');
break;
}
// BK;
break;
}
}
// Add some LIMITs
$objGetCondition->appendString(_SP)->appendString('LIMIT %LowerLimit, %UpperLimit')->doToken('%LowerLimit', $objLowerLimit)->doToken('%UpperLimit', $objUpperLimit);
// Set some requirements ...
$objLyricTable = $this->getLyrics($objGetCondition);
$objLyricTableCount = $this->getLyricCount();
// Set the template file ...
$tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'manageLyrics.tp');
TPL::tpSet($objLyricTable, new S('lyricTable'), $tpF);
TPL::tpSet($this->ATH, new S('ATH'), $tpF);
TPL::tpSet($this->STG, new S('STG'), $tpF);
TPL::tpExe($tpF);
// Do some pagination;
if ($objLyricTableCount->toInt() > 10) {
self::$objAdministration->setPagination($objLyricTableCount);
}
// Do the form, make it happen;
$this->renderForm(new S('lyricCreate'));
}
// BK;
break;
}
}
示例10: renderFrontendPage
/**
* 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 renderFrontendPage(S $objPageToRender, S $objTypeSwitcher)
{
// Do a switch on the rendered page ...
switch ($objTypeSwitcher) {
// Authentication ... and stuff;
case FRONTEND_AUTHENTICATION_URL:
// Check the mighty authenticate ...
if (isset($_GET[AUTHENTICATION_ACTION_URL])) {
// Do a switch ...
switch ($_GET[AUTHENTICATION_ACTION_URL]) {
case AUTHENTICATION_REGISTER_URL:
// Set the template file ...
$tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'users-register.tp');
break;
case AUTHENTICATION_ACTIVATE_URL:
// Set the template file ...
$tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'users-activate.tp');
break;
case AUTHENTICATION_PROFILE_URL:
// Set the template file ...
$tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'users-profile.tp');
break;
case AUTHENTICATION_LOGOUT_URL:
// Log me OUT my wuv ...
$this->ATH->doLogOut();
// Get me HOME ... I'm LOST here ...
$this->setHeaderKey(URL::staticURL(new A(array(FRONTEND_SECTION_URL)), new A(array(FRONTEND_HOME))), new S('Location'));
break;
case AUTHENTICATION_YAHOO_BB_AUTH:
return $this->renderWidget(new S(AUTHENTICATION_YAHOO_BB_AUTH));
break;
}
} else {
// Set the template file ...
$tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'users.tp');
}
// Go my baby ... GO ...
TPL::tpSet($this->objURLImageDir, new S('objURLImageDir'), $tpF);
TPL::tpSet($this->ATH, new S('ATH'), $tpF);
TPL::tpSet($this->STG, new S('STG'), $tpF);
TPL::tpSet($this->TXT, new S('TXT'), $tpF);
TPL::tpSet($this->ART, new S('ART'), $tpF);
TPL::tpSet($this->AUD, new S('AUD'), $tpF);
TPL::tpSet($this->CNT, new S('CNT'), $tpF);
TPL::tpSet($this->FAQ, new S('FAQ'), $tpF);
TPL::tpSet($this->LRQ, new S('LRQ'), $tpF);
TPL::tpExe($tpF);
break;
case FRONTEND_ARTICLE_URL:
// Go my baby ... GO ...
$tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'news.tp');
TPL::tpSet($this->objURLImageDir, new S('objURLImageDir'), $tpF);
TPL::tpSet($this->ATH, new S('ATH'), $tpF);
TPL::tpSet($this->STG, new S('STG'), $tpF);
TPL::tpSet($this->TXT, new S('TXT'), $tpF);
TPL::tpSet($this->ART, new S('ART'), $tpF);
TPL::tpSet($this->AUD, new S('AUD'), $tpF);
TPL::tpSet($this->CNT, new S('CNT'), $tpF);
TPL::tpSet($this->FAQ, new S('FAQ'), $tpF);
TPL::tpSet($this->LRQ, new S('LRQ'), $tpF);
TPL::tpExe($tpF);
break;
case FRONTEND_CONTACT_URL:
// Go my baby ... GO ...
$tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'contact.tp');
TPL::tpSet($this->objURLImageDir, new S('objURLImageDir'), $tpF);
TPL::tpSet($this->ATH, new S('ATH'), $tpF);
TPL::tpSet($this->STG, new S('STG'), $tpF);
TPL::tpSet($this->TXT, new S('TXT'), $tpF);
TPL::tpSet($this->ART, new S('ART'), $tpF);
TPL::tpSet($this->AUD, new S('AUD'), $tpF);
TPL::tpSet($this->CNT, new S('CNT'), $tpF);
TPL::tpSet($this->FAQ, new S('FAQ'), $tpF);
TPL::tpSet($this->LRQ, new S('LRQ'), $tpF);
TPL::tpExe($tpF);
break;
case FRONTEND_FAQ_URL:
// Go my baby ... GO ...
$tpF = new FilePath($this->getPathToSkin()->toRelativePath() . 'faq.tp');
TPL::tpSet($this->objURLImageDir, new S('objURLImageDir'), $tpF);
TPL::tpSet($this->ATH, new S('ATH'), $tpF);
TPL::tpSet($this->STG, new S('STG'), $tpF);
TPL::tpSet($this->TXT, new S('TXT'), $tpF);
//.........这里部分代码省略.........