本文整理汇总了PHP中WebModule类的典型用法代码示例。如果您正苦于以下问题:PHP WebModule类的具体用法?PHP WebModule怎么用?PHP WebModule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WebModule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initializeForCommand
public function initializeForCommand()
{
switch ($this->command) {
case 'notice':
$response = null;
$responseVersion = 1;
if ($this->getOptionalModuleVar('BANNER_ALERT', false, 'notice')) {
$noticeData = $this->getOptionalModuleSection('notice');
if ($noticeData) {
$response = array('notice' => '', 'moduleID' => null, 'link' => $this->getOptionalModuleVar('BANNER_ALERT_MODULE_LINK', false, 'notice'));
// notice can either take a module or data model class or retriever class. The section is passed on. It must implement the HomeAlertInterface interface
if (isset($noticeData['BANNER_ALERT_MODULE'])) {
$moduleID = $noticeData['BANNER_ALERT_MODULE'];
$controller = WebModule::factory($moduleID);
$response['moduleID'] = $moduleID;
$string = "Module {$moduleID}";
} elseif (isset($noticeData['BANNER_ALERT_MODEL_CLASS'])) {
$controller = DataModel::factory($noticeData['BANNER_ALERT_MODEL_CLASS'], $noticeData);
$string = $noticeData['BANNER_ALERT_MODEL_CLASS'];
} elseif (isset($noticeData['BANNER_ALERT_RETRIEVER_CLASS'])) {
$controller = DataRetriever::factory($noticeData['BANNER_ALERT_RETRIEVER_CLASS'], $noticeData);
$string = $noticeData['BANNER_ALERT_RETRIEVER_CLASS'];
} else {
throw new KurogoConfigurationException("Banner alert not properly configured");
}
if (!$controller instanceof HomeAlertInterface) {
throw new KurogoConfigurationException("{$string} does not implement HomeAlertModule interface");
}
$response['notice'] = $controller->getHomeScreenAlert();
}
}
$this->setResponse($response);
$this->setResponseVersion($responseVersion);
break;
case 'modules':
if ($setcontext = $this->getArg('setcontext')) {
Kurogo::sharedInstance()->setUserContext($setcontext);
}
$responseVersion = 2;
$response = array('primary' => array(), 'secondary' => array(), 'customize' => $this->getOptionalModuleVar('ALLOW_CUSTOMIZE', true), 'displayType' => $this->getOptionalModuleVar('display_type', 'springboard'));
$allmodules = $this->getAllModules();
$navModules = Kurogo::getSiteSections('navigation', Config::APPLY_CONTEXTS_NAVIGATION);
foreach ($navModules as $moduleID => $moduleData) {
if ($module = Kurogo::arrayVal($allmodules, $moduleID)) {
$title = Kurogo::arrayVal($moduleData, 'title', $module->getModuleVar('title'));
$type = Kurogo::arrayVal($moduleData, 'type', 'primary');
$visible = Kurogo::arrayVal($moduleData, 'visible', 1);
$response[$type][] = array('tag' => $moduleID, 'title' => $title, 'visible' => (bool) $visible);
}
}
$this->setResponse($response);
$this->setResponseVersion($responseVersion);
break;
default:
$this->invalidCommand();
}
}
示例2: getCreditsHTML
protected function getCreditsHTML()
{
//get original device
$device = Kurogo::deviceClassifier()->getDevice();
//set browser to unknown so we don't get AppQ HTML
Kurogo::deviceClassifier()->setBrowser('unknown');
$module = WebModule::factory($this->configModule, 'credits_html');
$html = $module->fetchPage();
//restore device
Kurogo::deviceClassifier()->setDevice($device);
return $html;
}
示例3: afterUninstall
public function afterUninstall()
{
//Удаляем таблицу модуля
Yii::app()->db->createCommand()->dropTable(Page::model()->tableName());
Yii::app()->db->createCommand()->dropTable(PageTranslate::model()->tableName());
return parent::afterUninstall();
}
示例4: getModuleDefaultData
protected function getModuleDefaultData()
{
return array_merge(parent::getModuleDefaultData(), array(
'url'=>''
)
);
}
示例5: afterUninstall
public function afterUninstall()
{
Yii::app()->settings->clear('exchange1c');
$db = Yii::app()->db;
$db->createCommand()->dropTable('{{exchange1c}}');
return parent::afterUninstall();
}
示例6: init
/**
* Module constructor - Builds the initial module data
*
* @author vadim
*/
public function init()
{
// Set error handler
Yii::app()->errorHandler->errorAction = 'site/error/error';
/* Make sure we run the master module init function */
parent::init();
}
示例7: prepareAdminForSection
protected function prepareAdminForSection($section, &$adminModule) {
switch ($section) {
case 'primary_modules':
case 'secondary_modules':
$adminModule->setTemplatePage('module_order', $this->id);
$adminModule->addInternalJavascript("/modules/{$this->id}/javascript/admin.js");
$adminModule->addInternalCSS("/modules/{$this->id}/css/admin.css");
$allModules = $this->getAllModules();
$navigationModules = $this->getNavigationModules();
foreach ($allModules as $moduleID=>$module) {
$allModules[$moduleID] = $module->getModuleName();
}
foreach ($navigationModules[rtrim($section,'_modules')] as $moduleID=>$module) {
$sectionModules[$moduleID] = $module['title'];
}
$adminModule->assign('allModules', $allModules);
$adminModule->assign('sectionModules', $sectionModules);
break;
default:
return parent::prepareAdminForSection($section, $adminModule);
}
}
示例8: beforeControllerAction
public function beforeControllerAction($controller, $action)
{
if (parent::beforeControllerAction($controller, $action)) {
return true;
} else {
return false;
}
}
示例9: afterUninstall
public function afterUninstall()
{
//Удаляем таблицу модуля
Yii::app()->settings->clear('news');
Yii::app()->db->createCommand()->dropTable(News::model()->tableName());
Yii::app()->db->createCommand()->dropTable(NewsTranslate::model()->tableName());
return parent::afterUninstall();
}
示例10: afterUninstall
public function afterUninstall()
{
$db = Yii::app()->db;
$tablesArray = array(Wishlist::model()->tableName(), WishlistProducts::model()->tableName());
foreach ($tablesArray as $table) {
$db->createCommand()->dropTable($table);
}
return parent::afterUninstall();
}
示例11: afterInstall
public function afterInstall()
{
if (Yii::app()->hasModule('shop')) {
return parent::afterInstall();
} else {
Yii::app()->controller->addFlashMessage('Ошибка, Модуль интернет-магазин не устрановлен.');
return false;
}
}
示例12: afterUninstall
public function afterUninstall()
{
Yii::app()->settings->clear('contacts');
$db = Yii::app()->db;
$db->createCommand()->dropTable(ContactsMaps::model()->tableName());
$db->createCommand()->dropTable(ContactsMarkers::model()->tableName());
$db->createCommand()->dropTable(ContactsRouter::model()->tableName());
$db->createCommand()->dropTable(ContactsRouterTranslate::model()->tableName());
return parent::afterUninstall();
}
示例13: afterUninstall
public function afterUninstall()
{
$db = Yii::app()->db;
$tablesArray = array(ShopDiscount::model()->tableName(), $db->tablePrefix . 'shop_discount_category', $db->tablePrefix . 'shop_discount_manufacturer');
foreach ($tablesArray as $table) {
$db->createCommand()->dropTable($table);
}
GridColumns::model()->deleteAll("grid_id='shopdiscount-grid'");
return parent::afterUninstall();
}
示例14: afterUninstall
public function afterUninstall()
{
Yii::app()->settings->clear($this->id);
$db = Yii::app()->db;
$tablesArray = array(PollChoice::model()->tableName(), PollVote::model()->tableName(), Poll::model()->tableName());
foreach ($tablesArray as $table) {
$db->createCommand()->truncateTable($table);
$db->createCommand()->dropTable($table);
}
return parent::afterUninstall();
}
示例15: afterUninstall
public function afterUninstall()
{
Yii::app()->settings->clear($this->id);
//Yii::app()->unintallComponent('cart');
$db = Yii::app()->db;
$tablesArray = array(Order::model()->tableName(), OrderHistory::model()->tableName(), OrderProduct::model()->tableName(), OrderStatus::model()->tableName(), OrderProductHistroy::model()->tableName(), ShopPaymentMethod::model()->tableName(), ShopPaymentMethodTranslate::model()->tableName(), ShopDeliveryMethod::model()->tableName(), ShopDeliveryMethodTranslate::model()->tableName(), ShopDeliveryPayment::model()->tableName(), ProductNotifications::model()->tableName());
foreach ($tablesArray as $table) {
$db->createCommand()->dropTable($table);
}
return parent::afterInstall();
}