本文整理汇总了PHP中issetModule函数的典型用法代码示例。如果您正苦于以下问题:PHP issetModule函数的具体用法?PHP issetModule怎么用?PHP issetModule使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了issetModule函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
}
开发者ID:barricade86,项目名称:raui,代码行数:27,代码来源:MainController.php
示例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));
}
开发者ID:barricade86,项目名称:raui,代码行数:34,代码来源:MainController.php
示例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));
}
}
开发者ID:barricade86,项目名称:raui,代码行数:33,代码来源:SiteController.php
示例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;
}
}
开发者ID:barricade86,项目名称:raui,代码行数:31,代码来源:WebUser.php
示例5: init
public function init()
{
parent::init();
if (!issetModule('tariffPlans') || !issetModule('paidservices')) {
throw404();
}
}
开发者ID:barricade86,项目名称:raui,代码行数:7,代码来源:MainController.php
示例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;
}
开发者ID:barricade86,项目名称:raui,代码行数:30,代码来源:HApartment.php
示例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))));
}
开发者ID:alexjkitty,项目名称:estate,代码行数:35,代码来源:UserAds.php
示例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();
}
}
开发者ID:alexjkitty,项目名称:estate,代码行数:26,代码来源:BeginRequest.php
示例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);
}
开发者ID:barricade86,项目名称:raui,代码行数:30,代码来源:CustomUrlManager.php
示例10: init
public function init()
{
parent::init();
if (!issetModule('messages')) {
throw404();
}
$this->cityActive = SearchForm::cityInit();
}
开发者ID:barricade86,项目名称:raui,代码行数:8,代码来源:BaseMessagesController.php
示例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;
}
开发者ID:barricade86,项目名称:raui,代码行数:10,代码来源:Payments.php
示例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));
}
开发者ID:barricade86,项目名称:raui,代码行数:13,代码来源:ModuleUserController.php
示例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));
}
开发者ID:barricade86,项目名称:raui,代码行数:16,代码来源:MainController.php
示例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));
}
开发者ID:barricade86,项目名称:raui,代码行数:46,代码来源:SimilarAdsWidget.php
示例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;
}
开发者ID:barricade86,项目名称:raui,代码行数:43,代码来源:YandexRealty.php
示例16: getApartments
public static function getApartments($limit = 10, $usePagination = 1, $all = 1, $criteria = null)
{
$pages = array();
Yii::app()->getModule('apartments');
if ($criteria === null) {
$criteria = new CDbCriteria();
}
if (!$all) {
$criteria->addCondition('t.deleted = 0');
$criteria->addCondition('t.active = ' . Apartment::STATUS_ACTIVE);
if (param('useUserads')) {
$criteria->addCondition('owner_active = ' . Apartment::STATUS_ACTIVE);
}
}
$sort = new CSort('Apartment');
$sort->attributes = array('price' => 'price', 'date_created' => 'date_created');
if (!$criteria->order) {
$sort->defaultOrder = 't.date_up_search DESC, t.sorter DESC';
}
$sort->applyOrder($criteria);
$sorterLinks = self::getSorterLinks($sort);
$criteria->addCondition('t.owner_id = 1 OR t.owner_active = 1');
$criteria->addInCondition('t.type', Apartment::availableApTypesIds());
$criteria->addInCondition('t.price_type', array_keys(Apartment::getPriceArray(Apartment::PRICE_SALE, true)));
// find count
$apCount = Apartment::model()->count($criteria);
if ($usePagination) {
$pages = new CPagination($apCount);
$pages->pageSize = $limit;
$pages->applyLimit($criteria);
} else {
$criteria->limit = $limit;
}
if (issetModule('seo')) {
$criteria->with = array('seo');
}
// $apartments = Apartment::model()
// ->cache(param('cachingTime', 1209600), Apartment::getImagesDependency())
// ->with(array('images'))
// ->findAll($criteria);
return array('pages' => $pages, 'sorterLinks' => $sorterLinks, 'apCount' => $apCount, 'criteria' => $criteria);
}
开发者ID:barricade86,项目名称:raui,代码行数:42,代码来源:apartmentsHelper.php
示例17: 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 (isset($_GET['is_ajax'])) {
$this->renderPartial('view', array('model' => $model));
} else {
$this->render('view', array('model' => $model));
}
}
开发者ID:alexjkitty,项目名称:estate,代码行数:20,代码来源:MainController.php
示例18: myDateValidator
public function myDateValidator($param)
{
$dateStart = CDateTimeParser::parse($this->date_start, self::getYiiDateFormat());
// format to unix timestamp
$dateEnd = CDateTimeParser::parse($this->date_end, self::getYiiDateFormat());
// format to unix timestamp
if ($param == 'date_start' && $dateStart < CDateTimeParser::parse(date('Y-m-d'), 'yyyy-MM-dd')) {
$this->addError('date_start', tt('Wrong check-in date', 'booking'));
}
if ($param == 'date_end' && $dateEnd <= $dateStart) {
$this->addError('date_end', tt('Wrong check-out date', 'booking'));
}
if (issetModule('bookingcalendar')) {
$result = Yii::app()->db->createCommand()->select('id')->from('{{booking_calendar}}')->where('apartment_id = "' . $this->apartment_id . '" AND status = "' . Bookingcalendar::STATUS_BUSY . '" AND
UNIX_TIMESTAMP(date_start) > "' . $dateStart . '" AND UNIX_TIMESTAMP(date_end) < "' . $dateEnd . '"')->queryScalar();
if ($param == 'date_start' && $result) {
$this->addError('date', tt('You chose dates in the range of which there are busy days', 'bookingcalendar'));
}
}
}
开发者ID:alexjkitty,项目名称:estate,代码行数:20,代码来源:Booking.php
示例19: actionBookingform
public function actionBookingform($isFancy = 0)
{
Yii::app()->getModule('apartments');
$this->modelName = 'Apartment';
$apartment = $this->loadModel();
$this->modelName = 'Booking';
$booking = new Booking();
$booking->scenario = 'bookingform';
if (isset($_POST['Booking']) && BlockIp::checkAllowIp(Yii::app()->controller->currentUserIpLong) && !$apartment->deleted) {
$booking->attributes = $_POST['Booking'];
$booking->apartment_id = $apartment->id;
$booking->user_ip = Yii::app()->controller->currentUserIp;
$booking->user_ip_ip2_long = Yii::app()->controller->currentUserIpLong;
if ($booking->validate()) {
$booking->time_inVal = $this->getI18nTimeIn($booking->time_in);
$booking->time_outVal = $this->getI18nTimeOut($booking->time_out);
if (issetModule('bookingtable')) {
Bookingtable::addRecord($booking);
}
$types = Apartment::getI18nTypesArray();
$booking->type = $types[Apartment::TYPE_RENT];
$ownerApartment = User::model()->findByPk($apartment->owner_id);
$booking->ownerEmail = $ownerApartment->email;
$notifier = new Notifier();
$notifier->raiseEvent('onNewBooking', $booking, array('user' => $ownerApartment));
Yii::app()->user->setFlash('success', tt('Operation successfully complete. Your order will be reviewed by owner.'));
$this->redirect($apartment->getUrl());
}
}
$user = null;
if (!Yii::app()->user->isGuest) {
$user = User::model()->findByPk(Yii::app()->user->getId());
}
if ($isFancy) {
$this->excludeJs();
$this->renderPartial('bookingform', array('apartment' => $apartment, 'model' => $booking, 'isFancy' => true, 'user' => $user), false, true);
} else {
$this->render('bookingform', array('apartment' => $apartment, 'model' => $booking, 'isFancy' => false, 'user' => $user));
}
}
开发者ID:barricade86,项目名称:raui,代码行数:40,代码来源:MainController.php
示例20: authenticate
/**
* Authenticates a user.
* @return boolean whether authentication succeeds.
*/
public function authenticate()
{
$user = User::model()->find('LOWER(email)=?', array(strtolower($this->username)));
if ($user === null) {
$this->errorCode = self::ERROR_USERNAME_INVALID;
return 0;
}
if (!$user->validatePassword($this->password)) {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
return 0;
} elseif (!$user->active) {
showMessage(Yii::t('common', 'Login'), Yii::t('common', 'Your account not active. The reasons: you not followed the link in the letter which has been sent at registration. Or administrator deactivate your account'), null, true);
return 0;
} else {
$this->_id = $user->id;
$this->username = $user->username;
$this->setState('email', $user->email);
$this->setState('username', $user->username);
$this->setState('phone', $user->phone);
if ($user->role == User::ROLE_ADMIN) {
$this->setState('isAdmin', 1);
}
if (issetModule('rbac')) {
$auth = Yii::app()->getAuthManager();
if (!$auth->isAssigned($user->role, $this->_id)) {
if ($auth->assign($user->role, $this->_id)) {
//Yii::app()->authManager->save();
}
}
} else {
if ($user->role == User::ROLE_MODERATOR) {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
return 0;
}
}
$this->errorCode = self::ERROR_NONE;
}
return $this->errorCode == self::ERROR_NONE;
}
开发者ID:barricade86,项目名称:raui,代码行数:43,代码来源:UserIdentity.php
注:本文中的issetModule函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论