本文整理汇总了PHP中Classes::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Classes::model方法的具体用法?PHP Classes::model怎么用?PHP Classes::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Classes
的用法示例。
在下文中一共展示了Classes::model方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTree
public static function getTree()
{
$criteria = new CDbCriteria();
$criteria->alias = 'Classes';
$criteria->order = 'class_name';
$objRet = Classes::model()->findAll($criteria);
return Classes::getDataFormatted(Classes::parseTree($objRet, 0));
}
示例2: array
<?php
echo $form->listBox($model, 'families', CHtml::listData(Family::model()->findAll(array('order' => 'family')), 'family', 'family'), array('multiple' => 'multiple', 'class' => 'tall wider', 'onChange' => 'js:FillListValues(this)', 'onMouseDown' => 'js:GetCurrentListValues(this)'));
?>
<div class="clearfix"></div><?php
echo CHtml::link(Yii::t('admin', 'Clear All'), '#', array('class' => 'listboxReset', 'onclick' => 'js:jQuery($("#' . CHtml::activeId($model, 'families') . '").find("option").prop("selected", false))'));
?>
<?php
echo $form->error($model, 'families');
?>
</div>
<div class="span2">
<?php
echo $form->labelEx($model, 'classes');
?>
<?php
echo $form->listBox($model, 'classes', CHtml::listData(Classes::model()->findAll(array('order' => 'class_name')), 'class_name', 'class_name'), array('multiple' => 'multiple', 'class' => 'tall', 'onChange' => 'js:FillListValues(this)', 'onMouseDown' => 'js:GetCurrentListValues(this)'));
?>
<div class="clearfix"></div><?php
echo CHtml::link(Yii::t('admin', 'Clear All'), '#', array('class' => 'listboxReset', 'onclick' => 'js:jQuery($("#' . CHtml::activeId($model, 'classes') . '").find("option").prop("selected", false))'));
?>
<?php
echo $form->error($model, 'classes');
?>
</div>
<div class="span2">
<?php
echo $form->labelEx($model, 'keywords');
?>
<?php
echo $form->listBox($model, 'keywords', CHtml::listData(Tags::model()->findAll(array('select' => 't.tag', 'order' => 'tag', 'distinct' => true)), 'tag', 'tag'), array('multiple' => 'multiple', 'class' => 'tall', 'onChange' => 'js:FillListValues(this)', 'onMouseDown' => 'js:GetCurrentListValues(this)'));
?>
示例3: save_product
/**
* Save a product in the database (Create if need be)
*
* @param string $passkey
* @param int $intRowid
* @param string $strCode
* @param string $strName
* @param string $blbImage
* @param string $strClassName
* @param int $blnCurrent
* @param string $strDescription
* @param string $strDescriptionShort
* @param string $strFamily
* @param int $blnGiftCard
* @param int $blnInventoried
* @param double $fltInventory
* @param double $fltInventoryTotal
* @param int $blnMasterModel
* @param int $intMasterId
* @param string $strProductColor
* @param string $strProductSize
* @param double $fltProductHeight
* @param double $fltProductLength
* @param double $fltProductWidth
* @param double $fltProductWeight
* @param int $intTaxStatusId
* @param double $fltSell
* @param double $fltSellTaxInclusive
* @param double $fltSellWeb
* @param string $strUpc
* @param int $blnOnWeb
* @param string $strWebKeyword1
* @param string $strWebKeyword2
* @param string $strWebKeyword3
* @param int $blnFeatured
* @param string $strCategoryPath
* @return string
*/
public function save_product($passkey, $intRowid, $strCode, $strName, $blbImage, $strClassName, $blnCurrent, $strDescription, $strDescriptionShort, $strFamily, $blnGiftCard, $blnInventoried, $fltInventory, $fltInventoryTotal, $blnMasterModel, $intMasterId, $strProductColor, $strProductSize, $fltProductHeight, $fltProductLength, $fltProductWidth, $fltProductWeight, $intTaxStatusId, $fltSell, $fltSellTaxInclusive, $fltSellWeb, $strUpc, $blnOnWeb, $strWebKeyword1, $strWebKeyword2, $strWebKeyword3, $blnFeatured, $strCategoryPath)
{
if (!$this->check_passkey($passkey)) {
return self::FAIL_AUTH;
}
// We must preservice the Rowid of Products within the Web Store
// database and must therefore see if it already exists
$objProduct = Product::model()->findByPk($intRowid);
if (!$objProduct) {
$objProduct = new Product();
$objProduct->id = $intRowid;
}
$strName = trim($strName);
$strName = trim($strName, '-');
$strName = substr($strName, 0, 255);
$strCode = trim($strCode);
$strCode = str_replace('"', '', $strCode);
$strCode = str_replace("'", '', $strCode);
if (empty($strName)) {
$strName = 'missing-name';
}
if (empty($strDescription)) {
$strDescription = '';
}
$objProduct->code = $strCode;
$objProduct->title = $strName;
//$objProduct->class_name = $strClassName;
$objProduct->current = $blnCurrent;
$objProduct->description_long = $strDescription;
$objProduct->description_short = $strDescriptionShort;
//$objProduct->family = $strFamily;
$objProduct->gift_card = $blnGiftCard;
$objProduct->inventoried = $blnInventoried;
$objProduct->inventory = $fltInventory;
$objProduct->inventory_total = $fltInventoryTotal;
$objProduct->master_model = $blnMasterModel;
if ($intMasterId > 0) {
$objProduct->parent = $intMasterId;
} else {
$objProduct->parent = null;
}
$objProduct->product_color = $strProductColor;
$objProduct->product_size = $strProductSize;
$objProduct->product_height = $fltProductHeight;
$objProduct->product_length = $fltProductLength;
$objProduct->product_width = $fltProductWidth;
$objProduct->product_weight = $fltProductWeight;
$objProduct->tax_status_id = $intTaxStatusId;
$objProduct->sell = $fltSell;
$objProduct->sell_tax_inclusive = $fltSellTaxInclusive;
//If we're in TaxIn Mode, then SellWeb has tax and we reverse it.
if (_xls_get_conf('TAX_INCLUSIVE_PRICING', 0) == 1) {
if ($fltSellWeb != 0) {
//Tax in with a sell on web price
$objProduct->sell_web_tax_inclusive = $fltSellWeb;
//LS sends tax in web already
$objProduct->sell_web = Tax::StripTaxesFromPrice($fltSellWeb, $intTaxStatusId);
} else {
//We use our regular prices and copy them price
$objProduct->sell_web_tax_inclusive = $fltSellTaxInclusive;
$objProduct->sell_web = $fltSell;
}
//.........这里部分代码省略.........
示例4: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new User();
$profile = new Profile();
$modelClass = new Classes();
$this->performAjaxValidation(array($model, $profile));
if (isset($_POST['User'])) {
$model->attributes = $_POST['User'];
$model->activkey = Yii::app()->controller->module->encrypting(microtime() . $model->password);
$profile->attributes = $_POST['Profile'];
$profile->user_id = 0;
if ($model->validate() && $profile->validate()) {
$model->password = Yii::app()->controller->module->encrypting($model->password);
if ($model->save()) {
$profile->user_id = $model->id;
$profile->save();
/*Add role for user. added by phihx. date 14/02/2014*/
if (!empty($_POST['user_role'])) {
//foreach($_POST['user_role'] as $role){
Rights::assign($_POST['user_role'], $model->id);
//}
}
if (!empty($_POST['Classes']['id'])) {
$userClass = new UsersClass();
$userClass->user_id = $model->id;
$userClass->class_id = $_POST['Classes']['id'];
$userClass->save();
}
Yii::app()->user->setFlash('success', translate('Thêm mới người dùng thành công.'));
}
$this->redirect(PIUrl::createUrl('/user'));
} else {
$profile->validate();
}
}
/* Get All role. Added by Phihx. date 14/02/2014*/
$allRoles = $this->getAllRoleUser();
//$allClass = Classes::model()->findAll();
/*Get classes*/
$arrClass[''] = '---Chọn lớp---';
$classes = Classes::model()->findAllByAttributes(array('status' => Classes::STATUS_ACTIVE));
if (!empty($classes)) {
foreach ($classes as $class) {
$arrClass[$class->id] = $class->name;
}
}
$this->render('create', array('model' => $model, 'profile' => $profile, 'modelClass' => $modelClass, 'allRoles' => $allRoles, 'arrClass' => $arrClass, 'userCurrenRole' => array('student')));
}