Ejemplo n.º 1
0
    ?>
</h3>
        </div>
        <div class="portlet-body form form-horizontal">
            <div class="form-body">
                
                <div class="table-scrollable">
                    <table class="nav-list table table-hover" id="currencies">
                        <thead>
                            <tr>
								<th><?php 
    echo CurrenciesLang::model()->getAttributeLabel('name');
    ?>
</th>
								<th><?php 
    echo Currencies::model()->getAttributeLabel('symbol');
    ?>
</th>				
								<th><?php 
    echo Yii::t('app', 'Операции');
    ?>
</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php 
    foreach ($currencies as $currency) {
        ?>
								<tr>
									<td><?php 
        echo CHtml::encode($currency->lang->name);
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  */
 public function actionUpdate()
 {
     // check if user has permissions to updateProjects
     if (Yii::app()->user->checkAccess('updateProjects')) {
         if (Yii::app()->user->isManager) {
             // get Projects object from $_GET[id] parameter
             $model = $this->loadModel();
             // if Projects form exist
             if (isset($_POST['Projects'])) {
                 // set form elements to Projects model attributes
                 $model->attributes = $_POST['Projects'];
                 // validate and save
                 if ($model->save()) {
                     // save log
                     $attributes = array('log_date' => date("Y-m-d G:i:s"), 'log_activity' => 'ProjectUpdated', 'log_resourceid' => $model->project_id, 'log_type' => Logs::LOG_UPDATED, 'user_id' => Yii::app()->user->id, 'module_id' => Yii::app()->controller->id, 'project_id' => $model->project_id);
                     Logs::model()->saveLog($attributes);
                     // to prevent F5 keypress, redirect to create page
                     $this->redirect(array('view', 'id' => $model->project_id));
                 }
             }
             // output update page
             $this->render('update', array('model' => $model, 'companies' => Companies::model()->findCompanyList(Yii::app()->user->id), 'currencies' => Currencies::model()->findAll()));
         } else {
             Yii::app()->controller->redirect(array("projects/view", 'id' => $_GET['id']));
         }
     } else {
         throw new CHttpException(403, Yii::t('site', '403_Error'));
     }
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreateProject()
 {
     // check if user has permissions to createProjects
     if (Yii::app()->user->checkAccess('createProjects') && Yii::app()->user->checkAccess('permissionsConfiguration') && Yii::app()->user->IsAdministrator) {
         // create Projects Object
         $model = new Projects();
         // if Projects form exist
         if (isset($_POST['Projects'])) {
             // set form elements to Projects model attributes
             $model->attributes = $_POST['Projects'];
             // validate and save
             if ($model->save()) {
                 // Create relation between user and project (this user will be first manager)
                 $modelForm = new ProjectsHasUsersForm();
                 $modelForm->project_id = $model->primaryKey;
                 $modelForm->user_id = Yii::app()->user->id;
                 $modelForm->isManager = 1;
                 $modelForm->saveUser();
                 // Select current project has default selection project
                 Yii::app()->user->setState('project_selected', $model->primaryKey);
                 Yii::app()->user->setState('project_selectedName', $model->project_name);
                 // save log
                 $attributes = array('log_date' => date("Y-m-d G:i:s"), 'log_activity' => 'ProjectCreated', 'log_resourceid' => $model->primaryKey, 'log_type' => Logs::LOG_ASSIGNED, 'user_id' => Yii::app()->user->id, 'module_id' => Yii::app()->controller->id, 'project_id' => $model->primaryKey);
                 Logs::model()->saveLog($attributes);
                 // to prevent F5 keypress, redirect to create page
                 Yii::app()->controller->redirect(Yii::app()->createUrl('projects/view', array('id' => $model->primaryKey)));
             }
         }
         $this->layout = 'column2';
         // output create page
         $this->render('../projects/create', array('model' => $model, 'companies' => Companies::model()->findCompanyList(Yii::app()->user->id), 'currencies' => Currencies::model()->findAll()));
     } else {
         throw new CHttpException(403, Yii::t('site', '403_Error'));
     }
 }
Ejemplo n.º 4
0
?>
        </div>
        <br />
        <div class="col-sm-2 control-label">Portfolio:</div>
        <div class="col-sm-2">
            <?php 
$ports = Portfolios::model()->findAll(['condition' => 'client_id = :client_id', 'params' => array(':client_id' => $client_id)]);
$list = CHtml::listData($ports, 'id', 'portfolio');
echo CHtml::dropDownList('portfolio', $portfolio, $list, ['id' => 'portfolio', 'empty' => '-- Select --', 'onchange' => 'overviewload()', 'class' => "form-control"]);
?>
        </div>
        
        <div class="col-sm-2 control-label">Currency:</div>
        <div class="col-sm-2">
            <?php 
echo CHtml::dropDownList('currency', 'USD', CHtml::listData(Currencies::model()->findAll(), 'currency', 'currency'), ['id' => 'currency', 'empty' => '-- Select --', 'onchange' => 'overviewload()', 'class' => "form-control"]);
?>
        </div>
        
        <div class="col-sm-2 control-label">Instrument:</div>
        <div class="col-sm-2">
            <?php 
echo CHtml::dropDownList('instrument', '', CHtml::listData(Instruments::model()->findAll(), 'id', 'instrument'), ['id' => 'instrument', 'empty' => '-- Select --', 'onchange' => 'overviewload()', 'class' => "form-control"]);
?>
        </div>

</div>
</form>

<div id="overview-view"></div>
<div id="wait" style="display:none;width:69px;height:89px;position:absolute;top:50%;left:50%;padding:2px;">
Ejemplo n.º 5
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Currencies the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Currencies::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }