public function init()
 {
     // --- Организации
     $c_id = Campaign::getId();
     if ($c_id) {
         Payment::$table_prefix = $c_id . '_';
         //Profile::$table_prefix = $c_id.'_';
         //ProfileField::$table_prefix = $c_id.'_';
         ProjectChanges::$table_prefix = $c_id . '_';
         ProjectChanges::$file_path = 'uploads/c' . $c_id . '/changes_documents';
         //ProjectMessages::$table_prefix = $c_id.'_';
         ProjectPayments::$table_prefix = $c_id . '_';
         Zakaz::$table_prefix = $c_id . '_';
         Zakaz::$files_folder = '/uploads/c' . $c_id . '/';
         Events::$table_prefix = $c_id . '_';
         ZakazParts::$table_prefix = $c_id . '_';
         UpdateProfile::$table_prefix = $c_id . '_';
         ZakazPartsFiles::$table_prefix = $c_id . '_';
         PaymentImage::$table_prefix = $c_id . '_';
         Emails::$table_prefix = $c_id . '_';
         Yii::app()->language = Campaign::getLanguage();
     } else {
         ProjectChanges::$file_path = 'uploads/changes_documents';
     }
     // ---
     if (!Yii::app()->user->isGuest) {
         switch (User::model()->getUserRole()) {
             case 'Manager':
             case 'Admin':
                 Yii::app()->theme = 'admin';
                 break;
             case 'Author':
                 $this->menu = array(array('label' => Yii::t('site', 'My orders'), 'url' => array('/project/zakaz/ownList')), array('label' => Yii::t('site', 'New projects'), 'url' => array('/project/zakaz/list')), array('label' => Yii::t('site', 'Profile'), 'url' => array('/user/profile/edit')), array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout')));
                 $this->authMenu = array(array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout')));
                 Yii::app()->theme = 'client';
                 break;
             case 'Customer':
                 $this->menu = array(array('label' => Yii::t('site', 'My orders'), 'url' => array('/project/zakaz/customerOrderList')), array('label' => Yii::t('site', 'Create order'), 'url' => array('/project/zakaz/create')), array('label' => Yii::t('site', 'Profile'), 'url' => array('/user/profile/edit')), array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout')));
                 $this->authMenu = array(array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout')));
                 Yii::app()->theme = 'client';
                 break;
         }
     }
     //		var_dump(Yii::app()->controller->module->id ,Yii::app()->controller->id, Yii::app()->controller->action->id);
     //		die();
 }
 public function actionChStatus($id, $status)
 {
     $model = UpdateProfile::model()->findByPk($id);
     if ($status == 'appove') {
         $model->status = 1;
         $attribute = $model->attribute;
         $profile = Profile::model()->findbyPk($model->user);
         $profile->{$attribute} = $model->to_data;
         if ($profile->save(false)) {
             $model->save();
         }
         if (YII_DEBUG) {
             CVarDumper::dump($profile->errors);
         }
     }
     if ($status == 'reject') {
         $model->status = 0;
         $model->save();
     }
     $countRecord = UpdateProfile::model()->countByAttributes(array('user' => $model->user, 'status' => null));
     //если записей для редактирования нет, то удаляем сообщения из списка сообщений
     if ($countRecord <= 0) {
         // сменим всем событиям статус на выполненый у данного пользователя
         Yii::import('application.modules.project.components.EventHelper');
         $eventList = Events::model()->findAllByAttributes(array('type' => EventHelper::TYPE_UPDATE_PROFILE, 'event_id' => $model->user));
         foreach ($eventList as $event) {
             $event->delete();
         }
     }
     // ответ
     if (Yii::app()->request->isAjaxRequest) {
         Yii::app()->end();
     }
     Yii::app()->redirect(Yii::app()->request->urlReferrer);
 }
Esempio n. 3
0
 protected function getChanges()
 {
     $res = false;
     if (!empty($this->_modelSave)) {
         foreach ($this->_modelSave as $key => $value) {
             if ($this->{$key} != $value) {
                 UpdateProfile::addRecord($key, $value, $this->{$key});
                 $res = true;
             }
         }
         if ($res) {
             // можно внести в конфигу
             Yii::import('application.modules.project.components.EventHelper');
             EventHelper::updateProfile();
         }
     }
     return $res;
 }
Esempio n. 4
0
        // checking query in right or not
        if ($personlupdate) {
            //echo '<script>alert(" Personal Detail Updated Successfully");javascript:history.go(-1);</script>';
            echo '<script type="text/javascript">window.location ="../edit-profile.php?per_up=yes";</script>';
        } else {
            echo "Error in User Personal Detail Update" . mysql_error();
        }
    }
    public function ProfessionalDetail()
    {
        $user = $_SESSION['username'];
        $designation = mysql_real_escape_string($_POST['designation']);
        $expyear = mysql_real_escape_string($_POST['year']);
        $expmonth = mysql_real_escape_string($_POST['month']);
        $keyskills = mysql_real_escape_string($_POST['keyskills']);
        $professupdate = mysql_query("update professional_detail set designation='{$designation}',expmonth='{$expmonth}',expyear='{$expyear}',keyskills='{$keyskills}',last_update_pro=now() where username='******';");
        if ($professupdate) {
            echo '<script type="text/javascript">window.location ="../edit-profile.php?pro_up=yes";</script>';
        } else {
            echo "Error in User Professional Detail Update" . mysql_error();
        }
    }
}
if (isset($_POST['personal'])) {
    $personaldetail = new UpdateProfile();
    $personaldetail->PersonalDetail();
}
if (isset($_POST['professional'])) {
    $professionaldetail = new UpdateProfile();
    $professionaldetail->ProfessionalDetail();
}