/**
  * 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 ProjectStatus the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = ProjectStatus::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Esempio n. 2
0
<?php

/* @var $this ZakazController */
/* @var $model Zakaz */
$filelist = Yii::app()->fileman->list_files($model->id);
foreach ($filelist as $fd) {
    $real_path = Yii::app()->fileman->get_file_path($fd['id'], $fd['file_id']);
    $files .= CHtml::link($fd['filename'], array('zakaz/download', 'path' => $real_path)) . '&nbsp;&nbsp;';
    //echo EDownloadHelper::download($real_path);
}
$this->breadcrumbs = array(ProjectModule::t('Zakazs') => array('index'), $model->title);
?>

<h1><?php 
echo ProjectModule::t('View Zakaz');
?>
 #<?php 
echo $model->id;
?>
</h1>
<?php 
if (User::model()->isManager() || User::model()->isAdmin()) {
    $attr = array('id', array('name' => 'user_id', 'type' => 'raw', 'value' => User::model()->findByPk($model->user_id)->username), array('name' => 'category_id', 'type' => 'raw', 'value' => Categories::model()->findByPk($model->category_id)->cat_name), array('name' => 'job_id', 'type' => 'raw', 'value' => Jobs::model()->findByPk($model->job_id)->job_name), 'title', 'text', 'date', 'max_exec_date', 'date_finish', 'pages', 'add_demands', array('name' => 'status', 'type' => 'raw', 'value' => $model->status > 0 ? ProjectStatus::model()->findByPk($model->status)->status : null), 'is_payed', 'informed', 'notes');
} else {
    $attr = array('id', array('name' => 'user_id', 'type' => 'raw', 'value' => User::model()->findByPk($model->user_id)->username), array('name' => 'category_id', 'type' => 'raw', 'value' => Categories::model()->findByPk($model->category_id)->cat_name), array('name' => 'job_id', 'type' => 'raw', 'value' => $model->job_id > 0 ? Jobs::model()->findByPk($model->job_id)->job_name : null), 'title', 'text', 'date', 'max_exec_date', 'pages', 'add_demands', array('name' => 'status', 'type' => 'raw', 'value' => $model->status > 0 ? ProjectStatus::model()->findByPk($model->status)->status : null));
}
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => $attr));
$this->widget('application.modules.project.widgets.zakazParts.ZakazPartWidget', array('projectId' => $model->id, 'userType' => '1', 'action' => 'show'));
Esempio n. 3
0
            }
        }
    }
    /*$columns[] = array(
          'name'=>'date',
          'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array(
              'model'=>$model,
              'attribute'=>'dbdate',
              'language'=>Yii::app()->language,
              ),true),
          'value'=>'$data->dbdate'
      );*/
    $columns[] = array('name' => 'manager_informed', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'dbmanager_informed', 'language' => Yii::app()->language), true), 'value' => '$data->dbmanager_informed');
    $columns[] = array('class' => 'CButtonColumn', 'template' => '{delete}{update}');
} else {
    $columns = array('id', array('name' => 'status', 'filter' => ProjectStatus::getAll(), 'value' => '$data->statusName'), 'title', array('name' => 'jobName', 'filter' => Jobs::getAll(), 'value' => '$data->jobName'), array('name' => 'catName', 'filter' => Categories::getAll()), array('name' => 'date', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'dbdate', 'language' => 'ru'), true), 'value' => '$data->dbdate'), array('name' => 'manager_informed', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'dbmanager_informed', 'language' => 'ru'), true), 'value' => '$data->dbmanager_informed'), array('name' => 'date_finish', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'dbdate_finishstart', 'language' => 'ru'), true) . $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'dbdate_finishend', 'language' => 'ru'), true), 'value' => '$data->dbdate_finish'), array('class' => 'CButtonColumn', 'template' => '{delete}{update}'));
}
?>
<div id="grid">
<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'order_list', 'dataProvider' => $model->search(), 'filter' => $model, 'afterAjaxUpdate' => 'reinstallDatePicker', 'columns' => $columns, 'ajaxType' => 'POST', 'rowHtmlOptionsExpression' => 'array("style" => "cursor:pointer")', 'selectionChanged' => "js:function(id){\n        document.location.href=\$('.selected').find('td').find('a.update').attr('href');\n    }"));
?>
<script>
    $(document).ready(function()
    {
        $('body').on('dblclick', '#order_list tbody tr', function(event)
        {
            var
                rowNum = $(this).index(),
                keys = $('#order_list > div.keys > span'),
                rowId = keys.eq(rowNum).text();
Esempio n. 4
0
						<?php 
$this->widget('ext.juidatetimepicker.EJuiDateTimePicker', array('model' => $model, 'attribute' => 'dbauthor_informed'));
?>
					</td>
				</tr>
			</table>
		</div>
		
		<div class="form-item" style="padding-left: 0; padding-right: 0;">
			<?php 
echo $form->errorSummary($model);
?>
			<div class="col-md-12">
				<?php 
echo $form->labelEx($model, 'status');
$models = ProjectStatus::model()->findAll();
$list = CHtml::listData($models, 'id', 'status');
echo $form->dropDownList($model, 'status', $list);
?>
				<?php 
echo $form->error($model, 'status');
?>
			</div>
			<div class="col-md-12">
				<?php 
echo $form->labelEx($model, 'user_id');
$list = CHtml::listData(User::model()->findAllCustomers(), 'id', 'email');
echo $form->dropDownList($model, 'user_id', $list, array('empty' => ProjectModule::t('Select a customer')));
?>
				<?php 
echo $form->error($model, 'user_id');
Esempio n. 5
0
</a>
</div>
<?php 
$this->breadcrumbs = array(ProjectModule::t('Zakazs'));
$columns = array('id');
$columns[] = array('name' => 'title');
if (ProjectField::model()->inTableByVarname('specials')) {
    $columns[] = array('name' => 'specials', 'filter' => Catalog::getAll('specials'), 'value' => '$data->catalog_specials->cat_name');
}
if (ProjectField::model()->inTableByVarname('specials2')) {
    $columns[] = array('name' => 'specials2', 'filter' => Catalog::getAll('specials2'), 'value' => '$data->catalog_specials2->cat_name');
}
$columns[] = array('name' => 'max_exec_date', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'dbmax_exec_date', 'language' => Yii::app()->language), true), 'value' => '$data->dbmax_exec_date');
$columns[] = array('name' => 'author_informed', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'dbauthor_informed', 'language' => Yii::app()->language), true), 'value' => '$data->dbauthor_informed');
$columns[] = array('name' => 'manager_informed', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'dbmanager_informed', 'language' => Yii::app()->language), true), 'value' => '$data->dbmanager_informed');
$columns[] = array('name' => 'status', 'filter' => ProjectStatus::getAll(), 'value' => '$data->statusName');
$columns[] = array('name' => 'lastPartStatus', 'filter' => ZakazParts::model()->getForFilter(), 'value' => '$data->lastPartStatus');
$columns[] = array('name' => 'lastPartDate', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'lastPartDate', 'language' => Yii::app()->language), true), 'value' => '$data->lastPartDate');
if (ProjectField::model()->inTableByVarname('technicalspec')) {
    $columns[] = array('name' => 'technicalspec', 'value' => '$data->technicalspec == 1 ? ProjectModule::t(\'Yes\') : ProjectModule::t(\'No\')', 'filter' => array("0" => ProjectModule::t('No'), "1" => ProjectModule::t('Yes')));
}
$columns[] = array('class' => 'CButtonColumn', 'template' => '{delete}{update}');
/*
$projectFields = $model->getFields();
if ($projectFields) {
	foreach($projectFields as $field) {
		if ($field->field_type=="LIST"){
			$varname = $field->varname;
			$arr = Catalog::getAll($varname);
			if (!$arr) $arr = Catalog::getAll($varname, 0); // Если список одноуровненвый
			$columns[] = array(
Esempio n. 6
0
 /**
  * @param string $get_array
  * @return string
  * @throws ProjectIDMissingException
  */
 public static function get_project_status_bar($get_array)
 {
     if ($get_array) {
         $_GET = unserialize($get_array);
     }
     if ($_GET['project_id']) {
         $project = new Project($_GET['project_id']);
         $template = new HTMLTemplate("project/ajax/detail_status.html");
         // Status Bar
         $all_status_array = $project->get_all_status_array();
         $result = array();
         $counter = 0;
         if (is_array($all_status_array) and count($all_status_array) >= 1) {
             foreach ($all_status_array as $key => $value) {
                 $project_status = new ProjectStatus($value['id']);
                 if ($value['optional'] == true) {
                     $result[$counter]['name'] = $project_status->get_name() . " (optional)";
                 } else {
                     $result[$counter]['name'] = $project_status->get_name();
                 }
                 if ($value['status'] == 3) {
                     $result[$counter]['icon'] = "<img src='images/icons/status_cancel.png' alt='R' />";
                 } elseif ($value['status'] == 2) {
                     $result[$counter]['icon'] = "<img src='images/icons/status_ok.png' alt='R' />";
                 } elseif ($value['status'] == 1) {
                     $result[$counter]['icon'] = "<img src='images/icons/status_run.png' alt='R' />";
                 } else {
                     $result[$counter]['icon'] = "";
                 }
                 if (!($counter % 2)) {
                     $result[$counter]['tr_class'] = " class='trLightGrey'";
                 } else {
                     $result[$counter]['tr_class'] = "";
                 }
                 $counter++;
             }
             $project_status = new ProjectStatus(2);
             $result[$counter]['name'] = $project_status->get_name();
             if ($project->get_current_status_id() == 2) {
                 $result[$counter]['icon'] = "<img src='images/icons/status_ok.png' alt='R' />";
             } else {
                 $result[$counter]['icon'] = "";
             }
             if (!($counter % 2)) {
                 $result[$counter]['tr_class'] = " class='trLightGrey'";
             } else {
                 $result[$counter]['tr_class'] = "";
             }
             $counter++;
         }
         $template->set_var("status", $result);
         $template->output();
     } else {
         throw new ProjectIDMissingException();
     }
 }
Esempio n. 7
0
 /**
  * @see ProjectInterface::get_next_status_name()
  * @return string
  */
 public function get_next_status_name()
 {
     if ($this->is_next_status_available()) {
         $next_status_id = $this->get_next_status_id();
         $project_status = new ProjectStatus($next_status_id);
         return $project_status->get_name();
     } else {
         return null;
     }
 }
Esempio n. 8
0
  $files .= CHtml::link($fd['filename'], array('zakaz/download', 'path' => $real_path)).'&nbsp;&nbsp;';
  //echo EDownloadHelper::download($real_path);
}
*/
$this->breadcrumbs = array(ProjectModule::t('Zakazs') => array('index'), $model->title);
?>

<h1><?php 
echo ProjectModule::t('View Zakaz');
?>
 #<?php 
echo $model->id;
?>
</h1>
<?php 
$attr = array('id', array('name' => 'user_id', 'type' => 'raw', 'value' => User::model()->findByPk($model->user_id)->username), 'title', 'max_exec_date', array('name' => 'status', 'type' => 'raw', 'value' => $model->status > 0 ? ProjectStatus::model()->findByPk($model->status)->status : null), 'notes');
//$this->widget('zii.widgets.CDetailView', array(
//	'data'=>$model,
//	'attributes'=>$attr,
//));
/*	
echo '<pre>';
print_r($projectFields);
echo '</pre>';
*/
$projectFields = $model->getFields();
if ($projectFields) {
    /*$form = $this->beginWidget('CActiveForm', array(
    			'id'=>'zakaz-form',
    			'action'=>isset ($model->id) ? $this->createUrl('zakaz/update', ['id'=>$model->id]) : '',
    			'enableAjaxValidation'=>false,
 /**
  * @throws ProjectStatusIDMissingException
  */
 public static function edit()
 {
     if ($_GET['id']) {
         $project_status = new ProjectStatus($_GET['id']);
         if ($_GET['nextpage'] == 1) {
             $page_1_passed = true;
             if (!$_POST['name']) {
                 $page_1_passed = false;
                 $error = "You must enter a name";
             }
         } else {
             $page_1_passed = false;
             $error = "";
         }
         if ($page_1_passed == false) {
             $template = new HTMLTemplate("project/admin/project_status/edit.html");
             $paramquery = $_GET;
             $paramquery['nextpage'] = "1";
             $params = http_build_query($paramquery, '', '&#38;');
             $template->set_var("params", $params);
             if ($error) {
                 $template->set_var("error", $error);
             } else {
                 $template->set_var("error", "");
             }
             if ($_POST['name']) {
                 $template->set_var("name", $_POST['name']);
             } else {
                 $template->set_var("name", $project_status->get_name());
             }
             $template->output();
         } else {
             $paramquery = $_GET;
             unset($paramquery['nextpage']);
             unset($paramquery['action']);
             $params = http_build_query($paramquery);
             if ($project_status->set_name($_POST['name'])) {
                 Common_IO::step_proceed($params, "Edit Project Status", "Operation Successful", null);
             } else {
                 Common_IO::step_proceed($params, "Edit Project Status", "Operation Failed", null);
             }
         }
     } else {
         throw new ProjectStatusIDMissingException();
     }
 }
Esempio n. 10
0
    <div class="row">
       <!-- Left column -->

        <div class="col-xs-4 left-column">
            <div class="row zero-edge">
				<div class="col-xs-12 statusBlock">
                   <!--<span class="label label-warning"><b><?php 
//echo $message;
?>
</b></span>-->
				   <span class="block-title"><?php 
echo $form->labelEx($model, 'status');
?>
:&nbsp;</span>
				   <?php 
echo CHtml::dropDownList('Zakaz_status', $model->status, CHtml::listData(ProjectStatus::model()->findAll(), 'id', 'status'), array('ajax' => array('url' => $this->createUrl('/project/zakaz/update'), 'data' => 'js:"id=' . $model->id . '&sid="+this.value', 'cache' => false)));
?>

					<?php 
echo Tools::hint($hints['Zakaz_status'], 'hint-block __status');
?>
					<!--<button class="btn btn-primary btn-spam" onclick="spam(<?php 
echo $model->id;
?>
);" href=""><?php 
echo ProjectModule::t('Search author');
?>
</button>-->
					<br><span class="last-delivery"><?php 
echo ProjectModule::t('Last delivery') . ': ' . $model->last_spam;
?>
Esempio n. 11
0
 /**
  * @param integer $id
  * @return string
  * @throws ProjectLogIDMissingException
  * @throws ProjectSecurityAccessDeniedException
  */
 public static function get_less($id)
 {
     global $project_security;
     if ($project_security->is_access(3, false) == true) {
         if (is_numeric($id)) {
             $return_json_array = array();
             $project_log = new ProjectLog($id);
             if (($content = $project_log->get_content()) != null) {
                 $content = str_replace("\n", "<br />", $content);
                 if (strlen($content) > 500) {
                     $content = substr($content, 0, 500) . "...";
                 }
                 $return_json_array[0] = $content;
             } else {
                 $return_json_array[0] = false;
             }
             $status_id = $project_log->get_status_id();
             if ($status_id != null) {
                 $project_status = new ProjectStatus($status_id);
                 $return_json_array[1] = $project_status->get_name();
             } else {
                 $return_json_array[1] = false;
             }
             $item_array = $project_log->list_items();
             $number_of_items = count($item_array);
             if ($number_of_items == 0) {
                 $return_json_array[2] = false;
             } else {
                 if ($number_of_items == 1) {
                     $return_json_array[2] = $number_of_items . " Item was added";
                 } else {
                     $return_json_array[2] = $number_of_items . " Items were added";
                 }
             }
             $return_json_array[3] = "Show more";
             return json_encode($return_json_array);
         } else {
             throw new ProjectLogIDMissingException();
         }
     } else {
         throw new ProjectSecurityAccessDeniedException();
     }
 }
Esempio n. 12
0
 /**
  * @see ProjectTaskInterface::get_name()
  * @return string
  */
 public function get_name()
 {
     if ($this->task_type and $this->task and $this->task_id) {
         if ($this->task->get_type_id() == 1) {
             $project_status = new ProjectStatus($this->task_type->get_end_status_id());
             if ($this->task_type->get_finalise() == true) {
                 return "Finalise " . $project_status->get_name();
             } else {
                 return "Achieve " . $project_status->get_name();
             }
         } else {
             return $this->task_type->get_name();
         }
     } else {
         return null;
     }
 }
Esempio n. 13
0
 /**
  * @throws ProjectTaskIDMissingException
  * @throws ProjectSecuriyAccessDeniedException
  */
 public static function detail()
 {
     global $user, $project_security;
     if ($_GET['id']) {
         if ($project_security->is_access(1, false) == true) {
             $project_task = new ProjectTask($_GET['id']);
             $project_task_owner = new User($project_task->get_owner_id());
             if ($project_task->get_start_time()) {
                 $project_task_start = new DatetimeHandler($project_task->get_start_date() . " " . $project_task->get_start_time());
             } else {
                 $project_task_start = new DatetimeHandler($project_task->get_start_date() . " 00:00:00");
             }
             if ($project_task->get_uf_end_time() != -1) {
                 $project_task_end = new DatetimeHandler($project_task->get_end_date() . " " . $project_task->get_end_time());
             } else {
                 $project_task_end = new DatetimeHandler($project_task->get_end_date() . " 23:59:59");
             }
             $project_task_created_at = new DatetimeHandler($project_task->get_created_at());
             $template = new HTMLTemplate("project/tasks/detail.html");
             switch ($project_task->get_type()) {
                 case 1:
                     $template->set_var("type", "Status Related Task");
                     $template->set_var("task_type", "1");
                     $template->set_var("progress", $project_task->get_progress() . "%");
                     $project_status = new ProjectStatus($project_task->get_begin_status_id());
                     $template->set_var("begin_status", $project_status->get_name());
                     break;
                 case 2:
                     $template->set_var("type", "Task");
                     $template->set_var("task_type", "2");
                     $template->set_var("progress", $project_task->get_progress() . "%");
                     break;
                 case 3:
                     $template->set_var("type", "Milestone");
                     $template->set_var("task_type", "3");
                     break;
                 default:
                     $template->set_var("type", "Undefined");
                     $template->set_var("task_type", "0");
                     break;
             }
             $template->set_var("owner", $project_task_owner->get_full_name(false));
             $template->set_var("start", $project_task_start->get_formatted_string("l, jS F Y H:i"));
             $template->set_var("end", $project_task_end->get_formatted_string("l, jS F Y H:i"));
             if ($project_task->get_auto_connect() == true) {
                 $template->set_var("auto_connect", "Yes");
             } else {
                 $template->set_var("auto_connect", "No");
             }
             $template->set_var("created_at", $project_task_created_at->get_formatted_string("l, jS F Y H:i"));
             $template->set_var("name", $project_task->get_name());
             if ($user->get_user_id() == $project_task->get_owner_id() or $user->is_admin()) {
                 $template->set_var("task_admin", true);
                 $paramquery = $_GET;
                 $paramquery['run'] = "task_edit_start";
                 $params = http_build_query($paramquery, '', '&#38;');
                 $template->set_var("task_edit_start_params", $params);
                 $paramquery = $_GET;
                 $paramquery['run'] = "task_edit_end";
                 $params = http_build_query($paramquery, '', '&#38;');
                 $template->set_var("task_edit_end_params", $params);
                 $paramquery = $_GET;
                 $paramquery['run'] = "task_delete";
                 $params = http_build_query($paramquery, '', '&#38;');
                 $template->set_var("delete_params", $params);
             } else {
                 $template->set_var("task_admin", false);
             }
             $template->output();
         } else {
             throw new ProjectSecuriyAccessDeniedException();
         }
     } else {
         throw new ProjectTaskIDMissingException();
     }
 }
 /**
  * Creates a new Project Folder including Folder
  * @param integer $project_id
  * @return integer
  */
 public function create($project_id, $project_status_id)
 {
     if (is_numeric($project_id) and is_numeric($project_status_id)) {
         $project_status = new ProjectStatus($project_status_id);
         $project = new Project($project_id);
         $project_folder_id = ProjectFolder::get_folder_by_project_id($project_id);
         $folder = new Folder($project_folder_id);
         $path = new Path($folder->get_path());
         $path->add_element("status-" . $project_status_id);
         if (($folder_id = parent::create($project_status->get_name(), $project_folder_id, $path->get_path_string(), $project->get_owner_id(), null)) != null) {
             $project_status_has_folder_access = new ProjectStatusHasFolder_Access(null);
             if ($project_status_has_folder_access->create($project_id, $project_status_id, $folder_id) == null) {
                 return null;
             }
             return $folder_id;
         } else {
             return null;
         }
     } else {
         return null;
     }
 }