本文整理汇总了PHP中category::model方法的典型用法代码示例。如果您正苦于以下问题:PHP category::model方法的具体用法?PHP category::model怎么用?PHP category::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类category
的用法示例。
在下文中一共展示了category::model方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mod
function mod()
{
$clang = Yii::app()->lang;
if (!Permission::model()->hasGlobalPermission('panellist', 'update')) {
Yii::app()->setFlashMessage($clang->gT("You do not have sufficient rights to access this page."), 'error');
$this->getController()->redirect(array("admin/index"));
}
$clang = Yii::app()->lang;
$action = isset($_POST['action']) ? $_POST['action'] : '';
$aData = array();
$aViewUrls = array();
if (Permission::model()->hasGlobalPermission('', 'create')) {
if ($action == "editcategory") {
// Project details
$category_id = (int) Yii::app()->request->getPost("category_id");
$category_title = flattenText($_POST['category_title'], false, true, 'UTF-8', true);
$sort_order = flattenText($_POST['sort_order'], false, true, 'UTF-8', true);
$IsActive = flattenText(Yii::app()->request->getPost("IsActive"));
$is_Active = 0;
if ($IsActive) {
$is_Active = 1;
}
if ($category_title == '') {
$aViewUrls['message'] = array('title' => $clang->gT("Failed to add Category"), 'message' => $clang->gT("Category Name is invalid."), 'class' => 'warningheader');
} else {
$oUser = category::model()->findByPk($category_id);
$oUser->title = $category_title;
$oUser->sorder = $sort_order;
$oUser->IsActive = $is_Active;
$oUser->modified_date = Date('y-m-d h:i:s');
$NewCategory = $oUser->save();
if ($NewCategory) {
Yii::app()->setFlashMessage($clang->gT("Profile Category Updated successfully"));
$this->getController()->redirect(array("admin/profilecategory/index"));
}
}
} else {
if (isset($_POST['category_id'])) {
$aData['row'] = 0;
$aData['usr_arr'] = array();
// Project detail
$category_id = (int) Yii::app()->request->getPost("category_id");
$action = Yii::app()->request->getPost("action");
$sresult = profilecategoryview($category_id);
// only use in view_editcompany
$aData['category_id'] = $category_id;
$aData['mur'] = $sresult;
$this->_renderWrappedTemplate('panellist/category', 'editcategory_view', $aData);
return;
}
}
}
Yii::app()->setFlashMessage(Yii::app()->lang->gT("You do not have sufficient rights to access this page."), 'error');
$this->getController()->redirect(array("admin/profilecategory/index"));
}
示例2: search
/**
* Retrieves a list of models based on the current search/filter conditions.
* @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
*/
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria = new CDbCriteria();
$criteria->compare('category_id', $this->category_id, true);
$criteria->compare('name', $this->name, true);
$criteria->compare('parent_id', $this->parent_id, true);
$criteria->compare('sort_order', $this->sort_order);
$criteria->compare('is_show', $this->is_show);
return new CActiveDataProvider(get_class($this), array('criteria' => $criteria));
}
public function getChildCount()
{
$cri = new CDbCriteria(array('condition' => 'parent_id =' . $this->category_id));
$childs = Category::model()->findAll($cri);
示例3: array
$clang->eT("Add Profile Question");
?>
</div>
<br />
<?php
echo CHtml::form(array("admin/profilequestion/sa/add"), 'post', array('class' => 'form30', 'id' => 'newprofilequestionform'));
?>
<ul>
<li>
<label for='category'><?php
$clang->eT("Category:");
?>
</label>
<?php
$category = category::model()->findAll(array('condition' => "IsActive = 1"));
$catlist = CHtml::listData($category, 'id', 'title');
echo CHtml::dropDownList('category', "", $catlist, array('prompt' => 'Select Category... ', 'required' => true));
?>
</li>
<li>
<label for='question_short_title'><?php
$clang->eT("Question Short Title:");
?>
</label>
<input type='text' id='question_short_title' name='question_short_title' required="required"/>
</li>
<li>
<label for='question_title'><?php
$clang->eT("Question Title :");
?>