Пример #1
0
 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
0
 /**
  * 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
0
$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...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', '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 :");
?>