本文整理汇总了PHP中CPropertyValue类的典型用法代码示例。如果您正苦于以下问题:PHP CPropertyValue类的具体用法?PHP CPropertyValue怎么用?PHP CPropertyValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CPropertyValue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: beforeAction
public function beforeAction($action)
{
$this->scanModules('payment');
$arrModules = Modules::model()->findAllByAttributes(array('category' => 'payment'), array('order' => 'module'));
$this->_allowAdvancedPayments = CPropertyValue::ensureBoolean(Yii::app()->params['ALLOW_ADVANCED_PAY_METHODS']);
$menuSidebar = array();
foreach ($arrModules as $module) {
$currentModule = Yii::app()->getComponent($module->module);
if (is_null($currentModule)) {
continue;
}
if ($currentModule->cloudCompatible === false && _xls_get_conf('LIGHTSPEED_CLOUD') > 0) {
continue;
}
if ($currentModule->isDisplayable() === false) {
continue;
}
$menuSidebar[] = array('label' => $currentModule->AdminName, 'url' => array('payments/module', 'id' => $module->module), 'advancedPayment' => $currentModule->advancedMode);
}
$advancedPaymentMethods = where($menuSidebar, array('advancedPayment' => true));
$simplePaymentMethods = where($menuSidebar, array('advancedPayment' => false));
$this->menuItems = array_merge(array(array('label' => 'Simple Integration Modules', 'linkOptions' => array('class' => 'nav-header'))), $simplePaymentMethods, array(array('label' => 'Advanced Integration Modules', 'linkOptions' => array('class' => 'nav-header'), 'visible' => count($advancedPaymentMethods) > 0)), $advancedPaymentMethods, $this->getPaymentSetupLinks());
$objModules = Modules::model()->findAllByAttributes(array('category' => 'payment', 'active' => 1));
if (count($objModules) === 0 && $action->id == "index") {
$this->noneActive = 1;
Yii::app()->user->setFlash('error', Yii::t('admin', 'WARNING: You have no payment modules activated. No one can checkout.'));
}
return parent::beforeAction($action);
}
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:29,代码来源:PaymentsController.php
示例2: actionBulkCreate
public function actionBulkCreate(array $names = array(), $parentId = 0, $vocabularyId = 0)
{
$vocabularyId = CPropertyValue::ensureInteger($vocabularyId);
if (!$vocabularyId) {
return errorHandler()->log('Missing Vocabulary Id');
}
foreach ($names as $catName) {
$catName = trim($catName);
if ($catName == '') {
continue;
}
$model = new Term('single_save');
$model->v_id = $vocabularyId;
$model->name = $catName;
$model->alias = Utility::createAlias($model, $model->name);
$model->state = Term::STATE_ACTIVE;
$model->parentId = $parentId;
if (!$model->save()) {
$this->result->fail(ERROR_HANDLING_DB, 'save category failed');
} else {
if ($model->parentId) {
$relation = TermHierarchy::model()->findByAttributes(array('term_id' => $model->id));
if (!is_object($relation)) {
$relation = new TermHierarchy();
$relation->term_id = $model->id;
}
$relation->parent_id = $model->parentId;
if (!$relation->save()) {
Yii::log(CVarDumper::dumpAsString($relation->getErrors()), CLogger::LEVEL_ERROR);
}
}
}
}
}
开发者ID:hung5s,项目名称:yap,代码行数:34,代码来源:TermApi.php
示例3: send
public function send($phones, $text)
{
$request = new DOMDocument("1.0", "UTF-8");
$requestBody = $request->createElement('SMS');
$requestBody->appendChild($this->createOperationsElement(array(self::SEND)));
$requestBody->appendChild($this->createAuthElement());
$request->appendChild($requestBody);
$sms = $request->createElement('message');
$sms->appendChild($request->createElement('sender', $this->sender));
$textElement = $request->createElement('text');
$textElement->appendChild(new DOMCdataSection($text));
$sms->appendChild($textElement);
$requestBody->appendChild($sms);
if (is_array($phones) == false) {
$phones = array($phones => array());
}
$numbers = $request->createElement('numbers');
foreach ($phones as $phone => $value) {
$variables = implode(';', CPropertyValue::ensureArray($value)) . ';';
$number = $request->createElement('number', $phone);
$number->setAttribute('messageid', md5($phone . date() . $variables));
$number->setAttribute('variables', $variables);
$numbers->appendChild($number);
}
$requestBody->appendChild($numbers);
$responseText = $this->doRequest($request->saveXML());
$result = $this->parseResponse($responseText);
$status = $result['status'];
$ok = (bool) ($status > 0);
$needSmsAlert = $ok == false && $status != -4;
$credits = $this->balance();
return array('status' => $status, 'ok' => $ok, 'responseText' => $responseText, 'credits' => $credits, 'needSmsAlert' => $needSmsAlert);
}
开发者ID:fduch2k,项目名称:yii-sms-manager,代码行数:33,代码来源:TSAtomparkGateway.php
示例4: render
public function render($params = array())
{
$height = CPropertyValue::ensureInteger($params['height']);
$height -= $height > 40 ? 20 : 0;
parent::appendOption($this->_htmlOptions, 'class', $this->_cssClass);
parent::appendOption($this->_htmlOptions, 'style', 'height: ' . $height . 'px;');
echo CHtml::tag('li', $this->_htmlOptions, $this->_data);
}
开发者ID:alexskull,项目名称:Ushi,代码行数:8,代码来源:QtzPanelElement_raw.php
示例5: getIsGuest
public function getIsGuest()
{
$customer = Customer::model()->findByPk($this->id);
if ($customer !== null) {
return CPropertyValue::ensureInteger($customer->record_type) === Customer::GUEST;
}
return parent::getIsGuest();
}
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:8,代码来源:WebUser.php
示例6: generateProductGrid
/**
* This function generates the products grid
* based on the criteria. It also generates the
* pagination object need for the users to navigate
* through products.
*
* @return void
*/
public function generateProductGrid()
{
$this->_numberOfRecords = Product::model()->count($this->_productGridCriteria);
$this->_pages = new CPagination($this->_numberOfRecords);
$this->_pages->setPageSize(CPropertyValue::ensureInteger(Yii::app()->params['PRODUCTS_PER_PAGE']));
$this->_pages->applyLimit($this->_productGridCriteria);
$this->_productsGrid = self::createBookends(Product::model()->findAll($this->_productGridCriteria));
}
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:16,代码来源:ProductGrid.php
示例7: getGridViewConfig
/**
* @return array the config array passed to widget ()
*/
public function getGridViewConfig()
{
if (!isset($this->_gridViewConfig)) {
$this->_gridViewConfig = array_merge(parent::getGridViewConfig(), array('possibleResultsPerPage' => array(5, 10, 20, 30, 40, 50, 75, 100), 'defaultGvSettings' => array('isActive' => 65, 'fullName' => 125, 'lastLogin' => 80, 'emailAddress' => 100), 'template' => CHtml::openTag('div', X2Html::mergeHtmlOptions(array('class' => 'page-title'), array('style' => !CPropertyValue::ensureBoolean($this->getWidgetProperty('showHeader')) && !CPropertyValue::ensureBoolean($this->getWidgetProperty('hideFullHeader')) ? 'display: none;' : ''))) . '<h2 class="grid-widget-title-bar-dummy-element">' . '</h2>{buttons}{filterHint}' . '{summary}{topPager}</div>{items}{pager}', 'includedFields' => array('tagLine', 'username', 'officePhone', 'cellPhone', 'emailAddress', 'googleId', 'isActive', 'leadRoutingAvailability'), 'specialColumns' => array('fullName' => array('name' => 'fullName', 'header' => Yii::t('profile', 'Full Name'), 'value' => 'CHtml::link(CHtml::encode($data->fullName),array("view","id"=>$data->id))', 'type' => 'raw'), 'lastLogin' => array('name' => 'lastLogin', 'header' => Yii::t('profile', 'Last Login'), 'value' => '$data->user ? ($data->user->lastLogin == 0 ? "" : ' . 'Formatter::formatDateDynamic ($data->user->lastLogin)) : ""', 'type' => 'raw'), 'isActive' => array('name' => 'isActive', 'header' => Yii::t('profile', 'Active'), 'value' => '"<span title=\'' . '".(Session::isOnline ($data->username) ? ' . '"' . Yii::t('profile', 'Active User') . '" : "' . Yii::t('profile', 'Inactive User') . '")."\'' . ' class=\'".(Session::isOnline ($data->username) ? ' . '"active-indicator" : "inactive-indicator")."\'></span>"', 'type' => 'raw'), 'username' => array('name' => 'username', 'header' => Yii::t('profile', 'Username'), 'value' => '$data->user ? CHtml::encode($data->user->alias) : ""', 'type' => 'raw'), 'leadRoutingAvailability' => array('name' => 'leadRoutingAvailability', 'header' => Yii::t('profile', 'Lead Routing Availability'), 'value' => 'CHtml::encode($data->leadRoutingAvailability ?
Yii::t("profile", "Available") :
Yii::t("profile", "Unavailable"))', 'type' => 'raw')), 'enableControls' => false));
}
return $this->_gridViewConfig;
}
开发者ID:dsyman2,项目名称:X2CRM,代码行数:12,代码来源:ProfilesGridViewProfileWidget.php
示例8: parseTree
public static function parseTree($objRet, $root = 0)
{
$return = array();
# Traverse the tree and search for direct children of the root
foreach ($objRet as $objItem) {
if (CPropertyValue::ensureInteger($objItem->child_count) > 0 || CPropertyValue::ensureBoolean(Yii::app()->params['DISPLAY_EMPTY_CATEGORY'])) {
$return[] = array('text' => CHtml::link($objItem->family, $objItem->Link), 'label' => $objItem->family, 'link' => $objItem->Link, 'request_url' => $objItem->request_url, 'url' => $objItem->Link, 'id' => $objItem->id, 'child_count' => $objItem->child_count, 'children' => null, 'items' => null);
}
}
return empty($return) ? null : $return;
}
开发者ID:hjlan,项目名称:webstore,代码行数:11,代码来源:Family.php
示例9: init
public function init()
{
$this->maxBlockTime = $this->getTimeInterval($this->maxBlockTime);
$this->alertRepeatInterval = $this->getTimeInterval($this->alertRepeatInterval);
$this->gatewayMinCredit = CPropertyValue::ensureFloat($this->gatewayMinCredit);
$gateways = array();
foreach ($this->gateways as $gateway) {
$gateways[] = Yii::createComponent($gateway);
}
$this->gateways = $gateways;
}
开发者ID:fduch2k,项目名称:yii-sms-manager,代码行数:11,代码来源:TSSmsManager.php
示例10: truncate
public function truncate($value, $length, $type = TruncateType::Character)
{
switch (CPropertyValue::ensureEnum($type, TruncateType)) {
case TruncateType::Paragraph:
return $this->truncateParagraph($value, $length);
case TruncateType::Word:
return $this->truncateWord($value, $length);
case TruncateType::Character:
default:
return $this->truncateCharacter($value, $length);
}
}
开发者ID:apa-narola,项目名称:yiimoduledemo,代码行数:12,代码来源:Formatter.php
示例11: enumValue
public static function enumValue($class, $id)
{
if ($id === '' || $id === null || $id === false) {
return '---';
}
$class = new ReflectionClass($class);
$values = $class->getConstants();
if (preg_match('/[0-9]+/', $id)) {
$values = array_values($values);
$id = isset($values[$id]) ? $values[$id] : '';
}
return self::formatLabel(CPropertyValue::ensureEnum($id, $class->name));
}
开发者ID:apa-narola,项目名称:yiimoduledemo,代码行数:13,代码来源:Enums.php
示例12: afterSave
/**
* Responds to {@link CActiveRecord::onAfterSave} event.
* Overrides this method if you want to handle the corresponding event of the {@link CBehavior::owner owner}.
* @param CModelEvent $event event parameter
*/
public function afterSave($event)
{
$data = array();
$objectId = $this->getOwner()->{$this->objectAttribute};
if ($this->useActiveField) {
$data = $this->getOwner()->{$this->name};
if (!is_array($data) && !is_object($data)) {
$data = array((int) $data);
}
} else {
if (isset($_POST[$this->name])) {
$data = $_POST[$this->name];
if (!is_array($data) && !is_object($data)) {
$data = array((int) $data);
}
}
}
//delete old
$sql = "DELETE FROM " . SITE_ID . '_' . "taxonomy_index t" . "\n USING " . SITE_ID . '_' . "taxonomy_term tt, " . SITE_ID . '_' . "taxonomy_vocabulary tv" . "\n WHERE tt.id = t.term_id AND tv.id = tt.v_id" . (is_numeric($this->taxonomy) ? "\n AND (tv.id = :id)" : "\n AND (tv.alias = :alias)") . "\n AND tv.module = :module AND t.object_id = :object_id";
if (count($data)) {
foreach ($data as $index => $val) {
$data[$index] = CPropertyValue::ensureInteger($val);
}
$dataString = implode(',', $data);
$sql .= "\n AND t.term_id NOT IN ({$dataString})";
}
$command = TermRelation::model()->getDbConnection()->createCommand($sql);
if (is_numeric($this->taxonomy)) {
$command->bindParam(":id", $this->taxonomy, PDO::PARAM_INT);
} else {
$command->bindParam(":alias", $this->taxonomy, PDO::PARAM_STR);
}
$command->bindParam(":module", $this->module, PDO::PARAM_STR);
$command->bindParam(":object_id", $objectId, PDO::PARAM_INT);
$command->execute();
//update/create
if (count($data)) {
foreach ($data as $val) {
$relation = TermRelation::model()->findByAttributes(array('object_id' => $objectId, 'term_id' => $val));
if (!is_object($relation)) {
$relation = new TermRelation();
}
$relation->object_id = $objectId;
$relation->term_id = $val;
if (!$relation->save()) {
Yii::log(CVarDumper::dumpAsString($relation->getErrors()), CLogger::LEVEL_ERROR);
}
}
}
}
开发者ID:hung5s,项目名称:yap,代码行数:55,代码来源:TaxonomyBehavior.php
示例13: prepareOutput
private function prepareOutput()
{
$preparedAttributes = array();
foreach ($this->getAttributes() as $key => $value) {
if (in_array($key, array('enableClientValidation', 'safe', 'skipOnError'))) {
$preparedAttributes[$key] = CPropertyValue::ensureBoolean($value);
}
if ($key === 'except' || $key === 'on') {
if (!is_null($value)) {
$preparedAttributes[$key] = array_map('trim', explode(',', $value));
}
}
}
return $preparedAttributes;
}
开发者ID:kuzmina-mariya,项目名称:unizaro-kamin,代码行数:15,代码来源:CFilterValidatorForm.php
示例14: beforeAction
public function beforeAction($action)
{
$this->scanModules('theme');
if (Yii::app()->theme) {
$this->currentTheme = Yii::app()->theme->name;
if (Theme::hasAdminForm($this->currentTheme)) {
$model = Yii::app()->getComponent('wstheme')->getAdminModel($this->currentTheme);
$this->currentTheme = $model->name;
}
} else {
$this->currentTheme = "unknown";
}
// Only old self-hosted customers can download/upgrade themes on their own.
$canDisplayThemeGallery = CPropertyValue::ensureBoolean(Yii::app()->params['LIGHTSPEED_HOSTING']) === false && CPropertyValue::ensureBoolean(Yii::app()->params['ALLOW_LEGACY_THEMES']);
$this->menuItems = array(array('label' => 'Manage My Themes', 'url' => array('theme/manage')), array('label' => 'Configure ' . ucfirst($this->currentTheme), 'url' => array('theme/module')), array('label' => 'Edit CSS for ' . ucfirst($this->currentTheme), 'url' => array('theme/editcss'), 'visible' => Theme::hasAdminForm(Yii::app()->theme->name)), array('label' => 'View Theme Gallery', 'url' => array('theme/gallery'), 'visible' => $canDisplayThemeGallery), array('label' => 'Upload Theme .Zip', 'url' => array('theme/upload'), 'visible' => !(Yii::app()->params['LIGHTSPEED_MT'] > 0)), array('label' => 'My Header/Image Gallery', 'url' => array('theme/image', 'id' => 1)), array('label' => 'Upload FavIcon', 'url' => array('theme/favicon'), 'visible' => !(Yii::app()->params['LIGHTSPEED_MT'] > 0)));
//run parent beforeAction() after setting menu so highlighting works
return parent::beforeAction($action);
}
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:18,代码来源:ThemeController.php
示例15: dropDownList
/**
* dropDownList Taxonomy
*
* @param string $name
* @param string $taxonomy
* @param string $module
* @param int $objectId
* @param array $htmlOptions
*/
public static function dropDownList($name, $taxonomy, $module, $objectId, $htmlOptions = array())
{
$properties = array('name' => $name, 'taxonomy' => $taxonomy, 'module' => $module, 'objectId' => $objectId);
if (isset($htmlOptions['type'])) {
$properties['type'] = CPropertyValue::ensureString($htmlOptions['type']);
unset($htmlOptions['type']);
}
if (isset($htmlOptions['repeatChar'])) {
$properties['repeatChar'] = CPropertyValue::ensureString($htmlOptions['repeatChar']);
unset($htmlOptions['repeatChar']);
}
if (isset($htmlOptions['useRepeatChar'])) {
$properties['useRepeatChar'] = CPropertyValue::ensureBoolean($htmlOptions['useRepeatChar']);
unset($htmlOptions['useRepeatChar']);
}
$properties['htmlOptions'] = $htmlOptions;
return Yii::app()->controller->widget('ListTaxonomy', $properties, true);
}
开发者ID:hung5s,项目名称:yap,代码行数:27,代码来源:TaxonomyHelper.php
示例16: actionIndex
/**
* @return void
*/
public function actionIndex()
{
$model = new Tag('search');
$model->userId = Yii::app()->user->id;
/* @var CHttpRequest $request */
$request = Yii::app()->request;
if ($request->getQuery('pagesize') != null) {
/* @var Setting $setting */
$setting = Setting::model()->name(Setting::PAGINATION_PAGE_SIZE_TAGS)->find();
$pageSize = CPropertyValue::ensureInteger($request->getQuery('pagesize'));
if ($pageSize > 0) {
$setting->value = $pageSize;
$setting->save();
}
}
if (isset($_GET['Tag'])) {
$model->attributes = $_GET['Tag'];
}
$this->render('index', array('model' => $model));
}
开发者ID:humantech,项目名称:ppma,代码行数:23,代码来源:TagController.php
示例17: actionIndex
/**
* Default action.
*
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*
* @return void
*/
public function actionIndex()
{
$homePage = _xls_get_conf('HOME_PAGE', '*products');
switch ($homePage) {
case "*index":
if (Yii::app()->params['LIGHTSPEED_MT'] == '1') {
if (Yii::app()->theme->info->showCustomIndexOption) {
$this->render("/site/index");
} else {
$this->forward("search/browse");
}
} else {
$this->render("/site/index");
}
break;
case "*products":
$this->forward("search/browse");
break;
default:
//Custom Page
$objCustomPage = CustomPage::LoadByKey($homePage);
$productsGrid = null;
$dataProvider = null;
if (!$objCustomPage instanceof CustomPage) {
_xls_404();
}
$this->pageTitle = $objCustomPage->PageTitle;
$this->pageDescription = $objCustomPage->meta_description;
$this->pageImageUrl = '';
$this->breadcrumbs = array($objCustomPage->title => $objCustomPage->RequestUrl);
if (CPropertyValue::ensureInteger($objCustomPage->product_display) === 2) {
$productsGrid = new ProductGrid($objCustomPage->getProductGridCriteria());
} else {
$dataProvider = $objCustomPage->taggedProducts();
}
$this->canonicalUrl = $objCustomPage->canonicalUrl;
$this->render('/custompage/index', array('model' => $objCustomPage, 'dataProvider' => $dataProvider, 'productsGrid' => $productsGrid));
break;
}
}
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:48,代码来源:SiteController.php
示例18: actionSetSidebarPositions
/**
* @throws CHttpException
* @return void
*/
public function actionSetSidebarPositions()
{
// only ajax-request are allowed
if (!Yii::app()->request->isAjaxRequest) {
throw new CHttpException(400);
}
$neededParams = array(Setting::MOST_VIEWED_ENTRIES_WIDGET_POSITION, Setting::RECENT_ENTRIES_WIDGET_POSITION, Setting::TAG_CLOUD_WIDGET_POSITION);
// check if all needed params exist
foreach ($neededParams as $paramName) {
if (!isset($_POST[$paramName])) {
throw new CHttpException(401);
}
}
// save settings
foreach ($neededParams as $paramName) {
/* @var Setting $model */
$param = CPropertyValue::ensureInteger($_POST[$paramName]);
$model = Setting::model()->findByAttributes(array('name' => $paramName));
$model->value = $param;
$model->save();
}
echo '1';
}
开发者ID:humantech,项目名称:ppma,代码行数:27,代码来源:SettingsController.php
示例19: send
public function send($phones, $text)
{
$sender = $this->sender;
$result = array();
foreach ($phones as $phone => $variables) {
$variables = CPropertyValue::ensureArray($variables);
$textMsg = $text;
$i = 1;
foreach ($variables as $variable) {
$textMsg = str_replace('%' . $i . '%', $variable, $textMsg);
$i++;
}
$args = array('login' => $this->username, 'password' => $this->password, 'messages' => array(array('clientId' => $sender, 'phone' => $phone, 'text' => $text)));
$response = $this->doRequest(self::SEND_URL, $args);
$responseText = CJSON::encode($response);
$resultStatus = false;
$credits = 0;
$status = isset($response['status']) ? $response['status'] : 'no status';
if ($status == 'ok') {
if (isset($response['messages']) == false || count($response['messages']) == 0) {
throw new Exception('No messages in response');
}
$message = $response['messages'][0];
$status = isset($message['status']) ? $message['status'] : 'no status';
$resultStatus = $status == 'accepted';
$response = $this->doRequest(self::CREDITS_URL, array('login' => $this->username, 'password' => $this->password));
if (isset($response['balance'])) {
$credits = $response['balance'][0]['balance'];
} else {
throw new Exception('No credits in response');
}
}
$result = array('ok' => $status == 'ok', 'status' => $status, 'responseText' => $responseText, 'credits' => $credits, 'needSmsAlert' => true);
}
return $result;
}
开发者ID:fduch2k,项目名称:yii-sms-manager,代码行数:36,代码来源:TSSmsFeedBackGateway.php
示例20: isDisplayable
/**
* We use this function to know if the payment method is allowed to be
* used.
*
* @return bool True if we can display the payment method. False
* otherwise.
*/
public function isDisplayable()
{
$allowAdvancedPayments = CPropertyValue::ensureBoolean(Yii::app()->params['ALLOW_ADVANCED_PAY_METHODS']);
if ($allowAdvancedPayments === false && $this->advancedMode === true) {
return false;
}
return parent::isDisplayable();
}
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:15,代码来源:WsPayment.php
注:本文中的CPropertyValue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论