本文整理汇总了PHP中issetModule函数的典型用法代码示例。如果您正苦于以下问题:PHP issetModule函数的具体用法?PHP issetModule怎么用?PHP issetModule使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了issetModule函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionView
public function actionView($id = 0, $url = '')
{
if ($url && issetModule('seo')) {
$seo = SeoFriendlyUrl::getForView($url, $this->modelName);
if (!$seo) {
throw404();
}
$this->setSeo($seo);
$id = $seo->model_id;
}
$model = $this->loadModel($id, 1);
if (!$model->active) {
throw404();
}
if ($model->id == 4) {
//User Agreement
$field = 'body_' . Yii::app()->language;
$model->{$field} = str_replace('{site_domain}', IdnaConvert::checkDecode(Yii::app()->getBaseUrl(true)), $model->{$field});
$model->{$field} = str_replace('{site_title}', CHtml::encode(Yii::app()->name), $model->{$field});
}
$this->showSearchForm = $model->widget && $model->widget == 'apartments' ? true : false;
if (Yii::app()->request->isAjaxRequest) {
$this->renderPartial('view', array('model' => $model));
} else {
$this->render('view', array('model' => $model));
}
}
示例2: actionUpdate
public function actionUpdate($id)
{
$model = $this->loadModel($id);
$model->scenario = 'update';
if (issetModule('rbac')) {
if (Yii::app()->user->role == User::ROLE_MODERATOR && $model->role == User::ROLE_ADMIN) {
throw404();
}
}
$this->performAjaxValidation($model);
if (isset($_POST[$this->modelName])) {
$model->attributes = $_POST[$this->modelName];
if (isset($_POST[$this->modelName]['password']) && $_POST[$this->modelName]['password']) {
if (demo()) {
Yii::app()->user->setFlash('error', tc('Sorry, this action is not allowed on the demo server.'));
unset($model->password, $model->salt);
$this->redirect(array('update', 'id' => $model->id));
} else {
$model->scenario = 'changePass';
}
} else {
unset($model->password, $model->salt);
}
if ($model->validate()) {
if ($model->scenario == 'changePass') {
$model->setPassword();
}
if ($model->save(false)) {
$this->redirect(array('view', 'id' => $model->id));
}
}
}
$this->render('update', array('model' => $model));
}
示例3: actionIndex
public function actionIndex()
{
$this->checkCookieEnabled();
$this->htmlPageId = 'index';
$page = Menu::model()->findByPk(InfoPages::MAIN_PAGE_ID);
if (issetModule('seo')) {
$seo = SeoFriendlyUrl::model()->findByAttributes(array('model_name' => 'InfoPages', 'model_id' => InfoPages::MAIN_PAGE_ID));
if ($seo) {
$this->setSeo($seo);
}
}
$langs = Lang::getActiveLangs();
$countLangs = count($langs);
if (!isFree() && !isset($_GET['lang']) && ($countLangs > 1 || $countLangs == 1 && param('useLangPrefixIfOneLang'))) {
$canonicalUrl = Yii::app()->getBaseUrl(true);
$canonicalUrl .= '/' . Yii::app()->language;
Yii::app()->clientScript->registerLinkTag('canonical', null, $canonicalUrl);
}
Yii::app()->user->setState('searchUrl', NULL);
$lastNews = News::getLastNews();
if (Yii::app()->request->isAjaxRequest) {
// $modeListShow = User::getModeListShow();
// if ($modeListShow == 'table') {
// # нужны скрипты и стили, поэтому processOutput установлен в true только для table
// $this->renderPartial('index', array('page' => $page, 'newsIndex' => $lastNews), false, true);
// }
// else {
$this->renderPartial('index', array('page' => $page, 'newsIndex' => $lastNews));
// }
} else {
$this->render('index', array('page' => $page, 'newsIndex' => $lastNews));
}
}
示例4: checkAccess
public function checkAccess($operation, $params = array(), $allowCaching = true)
{
if (issetModule('rbac')) {
if ($allowCaching && $params === array() && isset($this->_access[$operation])) {
return $this->_access[$operation];
}
$access = Yii::app()->getAuthManager()->checkAccess($operation, $this->getId(), $params);
if ($allowCaching && $params === array()) {
$this->_access[$operation] = $access;
}
return $access;
} else {
if (Yii::app()->user->isGuest) {
# гость
if ($operation == 'guest') {
return true;
}
} else {
if (Yii::app()->user->getState('isAdmin')) {
#админ
return true;
} else {
# авторизированный пользователь
if ($operation == 'registered' || $operation == 'guest') {
return true;
}
}
}
return false;
}
}
示例5: init
public function init()
{
parent::init();
if (!issetModule('tariffPlans') || !issetModule('paidservices')) {
throw404();
}
}
示例6: saveOther
public static function saveOther(Apartment $ad)
{
if (ApartmentVideo::saveVideo($ad)) {
$ad->panoramaFile = CUploadedFile::getInstance($ad, 'panoramaFile');
$ad->scenario = 'panorama';
if (!$ad->validate()) {
return false;
}
}
$city = "";
if (issetModule('location')) {
$city .= $ad->locCountry ? $ad->locCountry->getStrByLang('name') : "";
$city .= $city && $ad->locCity ? ", " : "";
$city .= $ad->locCity ? $ad->locCity->getStrByLang('name') : "";
} else {
$city = $ad->city ? $ad->city->getStrByLang('name') : "";
}
// data
if ($ad->address && $city && (param('useGoogleMap', 1) || param('useYandexMap', 1) || param('useOSMMap', 1))) {
if (!$ad->lat && !$ad->lng) {
# уже есть
$coords = Geocoding::getCoordsByAddress($ad->address, $city);
if (isset($coords['lat']) && isset($coords['lng'])) {
$ad->lat = $coords['lat'];
$ad->lng = $coords['lng'];
}
}
}
return true;
}
示例7: search
public function search()
{
$criteria = new CDbCriteria();
$tmp = 'title_' . Yii::app()->language;
$criteria->compare('id', $this->id);
$criteria->compare($tmp, $this->{$tmp}, true);
if (issetModule('location') && param('useLocation', 1)) {
$criteria->compare('loc_country', $this->loc_country);
$criteria->compare('loc_region', $this->loc_region);
$criteria->compare('loc_city', $this->loc_city);
} else {
$criteria->compare('city_id', $this->city_id);
}
$criteria->addCondition('owner_id = ' . Yii::app()->user->id);
if ($this->active === '0' || $this->active) {
$criteria->addCondition('active = :active');
$criteria->params[':active'] = $this->active;
}
if ($this->owner_active === '0' || $this->owner_active) {
$criteria->addCondition('owner_active = :active');
$criteria->params[':active'] = $this->owner_active;
}
if ($this->type) {
$criteria->addCondition('type = :type');
$criteria->params[':type'] = $this->type;
}
if ($this->obj_type_id) {
$criteria->addCondition('obj_type_id = :obj_type_id');
$criteria->params[':obj_type_id'] = $this->obj_type_id;
}
$criteria->addCondition('active <> :draft');
$criteria->params['draft'] = Apartment::STATUS_DRAFT;
$criteria->addInCondition('type', self::availableApTypesIds());
return new CActiveDataProvider($this, array('criteria' => $criteria, 'sort' => array('defaultOrder' => 'id DESC'), 'pagination' => array('pageSize' => param('userPaginationPageSize', 20))));
}
示例8: updateStatusAd
public static function updateStatusAd()
{
if (Yii::app()->request->getIsAjaxRequest() || !issetModule('paidservices')) {
return false;
}
if (!oreInstall::isInstalled()) {
return false;
}
$data = Yii::app()->statePersister->load();
// Обновляем статусы 1 раз в сутки
if (isset($data['next_check_status'])) {
if ($data['next_check_status'] < time()) {
$data['next_check_status'] = time() + self::TIME_UPDATE;
Yii::app()->statePersister->save($data);
self::checkStatusAd();
self::clearApartmentsStats();
// обновляем курсы валют
Currency::model()->parseCbr();
}
} else {
$data['next_check_status'] = time() + self::TIME_UPDATE;
Yii::app()->statePersister->save($data);
self::checkStatusAd();
self::clearApartmentsStats();
}
}
示例9: parseUrl
public function parseUrl($request)
{
if (issetModule('seo') && $this->parseReady === false && oreInstall::isInstalled()) {
if (preg_match('#^([\\w-]+)#i', $request->pathInfo, $matches)) {
$activeLangs = Lang::getActiveLangs();
$arr = array();
foreach ($activeLangs as $lang) {
$arr[] = 'url_' . $lang . ' = :alias';
}
$condition = '(' . implode(' OR ', $arr) . ')';
$seo = SeoFriendlyUrl::model()->find(array('condition' => 'direct_url = 1 AND ' . $condition, 'params' => array('alias' => $matches[1])));
if ($seo !== null) {
foreach ($activeLangs as $lang) {
$field = 'url_' . $lang;
if ($seo->{$field} == $matches[1]) {
setLangCookie($lang);
Yii::app()->setLanguage($lang);
//$_GET['lang'] = $lang;
}
}
$_GET['url'] = $matches[1];
//$_GET['id'] = $seo->model_id;
//Yii::app()->controller->seo = $seo;
return 'infopages/main/view';
}
}
$this->parseReady = true;
}
return parent::parseUrl($request);
}
示例10: init
public function init()
{
parent::init();
if (!issetModule('messages')) {
throw404();
}
$this->cityActive = SearchForm::cityInit();
}
示例11: getPaidserviceName
public function getPaidserviceName()
{
$return = '';
if ($this->tariff_id && issetModule('tariffPlans')) {
$return = tt('Purchase tariff plan', 'tariffPlans');
} elseif (isset($this->paidservice) && $this->paidservice) {
$return = $this->paidservice->name;
}
return $return;
}
示例12: actionView
public function actionView($id = 0, $url = '')
{
if ($url && issetModule('seo')) {
$seo = SeoFriendlyUrl::getForView($url, $this->modelName);
if (!$seo) {
throw404();
}
$this->setSeo($seo);
$id = $seo->model_id;
}
$model = $this->loadModel($id, 1);
$this->render('view', array('model' => $model));
}
示例13: actionView
public function actionView($id = 0, $url = '')
{
$criteria = new CDbCriteria();
$criteria->order = 'sorter';
$criteria->condition = 'active=1';
$articles = Article::model()->cache(param('cachingTime', 1209600), Article::getCacheDependency())->findAll($criteria);
if ($url && issetModule('seo')) {
$seo = SeoFriendlyUrl::getForView($url, $this->modelName);
if (!$seo) {
throw404();
}
$this->setSeo($seo);
$id = $seo->model_id;
}
$this->render('view', array('model' => $this->loadModel($id), 'articles' => $articles));
}
示例14: viewSimilarAds
public function viewSimilarAds($data = null)
{
$similarAds = new SimilarAds();
$criteria = new CDbCriteria();
$criteria->addCondition('active = ' . Apartment::STATUS_ACTIVE);
$criteria->addCondition('deleted = 0');
if (param('useUserads')) {
$criteria->addCondition('owner_active = ' . Apartment::STATUS_ACTIVE);
}
if ($data->id) {
$criteria->addCondition('t.id != :id');
$criteria->params[':id'] = $data->id;
}
if (issetModule('location')) {
if ($data->loc_city) {
$criteria->addCondition('loc_city = :loc_city');
$criteria->params[':loc_city'] = $data->loc_city;
}
} else {
if ($data->city_id) {
$criteria->addCondition('city_id = :city_id');
$criteria->params[':city_id'] = $data->city_id;
}
}
if ($data->obj_type_id) {
$criteria->addCondition('obj_type_id = :obj_type_id');
$criteria->params[':obj_type_id'] = $data->obj_type_id;
}
if ($data->type) {
$criteria->addCondition('type = :type');
$criteria->params[':type'] = $data->type;
}
if ($data->price_type) {
$criteria->addCondition('price_type = :price_type');
$criteria->params[':price_type'] = $data->price_type;
}
/*$criteria->limit = param('countListitng'.User::getModeListShow(), 10);*/
$criteria->limit = 8;
$criteria->order = 't.id ASC';
$ads = $similarAds->getSimilarAds($criteria);
if ($ads) {
$similarAds->publishAssets();
}
//print_r($criteria);
$this->render('widgetSimilarAds_list', array('ads' => $ads));
}
示例15: getMainData
public static function getMainData($id)
{
if ($id) {
$addSelect = '';
$addSelectJoin = '';
if (issetModule('location')) {
$addSelect = '
lc.name_' . Yii::app()->language . ' as loc_country_name,
lr.name_' . Yii::app()->language . ' as loc_region_name,
lcc.name_' . Yii::app()->language . ' as loc_city_name,
ap.loc_country, ap.loc_region, ap.loc_city,
';
$addSelectJoin = '
LEFT JOIN {{location_country}} lc ON lc.id = ap.loc_country
LEFT JOIN {{location_region}} lr ON lr.id = ap.loc_region
LEFT JOIN {{location_city}} lcc ON lcc.id = ap.loc_city
';
}
$sql = '
SELECT ap.id, ap.type, ap.obj_type_id,
ap.city_id, ap.price, ap.num_of_rooms, ap.floor, ap.floor_total, ap.square, ap.land_square, ap.window_to,
ap.title_' . Yii::app()->language . ', ap.description_' . Yii::app()->language . ',
ap.description_near_' . Yii::app()->language . ', ap.address_' . Yii::app()->language . ',
ap.berths, ap.price_type, ap.lat, ap.lng, ap.date_updated, ap.date_created,
' . $addSelect . '
ac.name_' . Yii::app()->language . ' as city_name,
awt.title_' . Yii::app()->language . ' as window_to_name,
u.phone as owner_phone, u.email as owner_email, u.id as owner_id, u.username as owner_username,
aop.name_' . Yii::app()->language . ' as obj_type_name
FROM {{apartment}} ap
' . $addSelectJoin . '
LEFT JOIN {{apartment_obj_type}} aop ON aop.id = ap.obj_type_id
LEFT JOIN {{apartment_city}} ac ON ac.id = ap.city_id
LEFT JOIN {{apartment_window_to}} awt ON awt.id = ap.window_to
LEFT JOIN {{users}} u ON u.id = ap.owner_id
WHERE ap.id = "' . (int) $id . '"
';
//echo Yii::app()->db->cache(param('cachingTime', 1209600), self::getFullDependency($id))->createCommand($sql)->text;
$results = Yii::app()->db->cache(param('cachingTime', 1209600), self::getFullDependency($id))->createCommand($sql)->queryRow();
return $results;
}
return false;
}