Beispiel #1
0
 public static function delModule($project_id)
 {
     try {
         $delete_data = ProjectDetail::findFirst(array('project_id = :project_id:', 'bind' => array('project_id' => $project_id)));
         if (isset($delete_data->project_id)) {
             $manager = new TxManager();
             $transaction = $manager->get();
             $delete_data->setTransaction($transaction);
             if ($delete_data->delete() == false) {
                 $transaction->rollback('数据更新失败-1');
             }
             #说明该项目下需求量表已导入过,则继续更新项目状态
             $project = Project::findFirst(array("id=?1", 'bind' => array(1 => $project_id)));
             $project->setTransaction($transaction);
             $project->state = $project->state - 1 >= 0 ? $project->state - 1 : 0;
             if ($project->save() == false) {
                 $transaction->rollback("数据插入失败-2");
             }
             $transaction->commit();
             return true;
         } else {
             return true;
         }
     } catch (TxFailed $e) {
         throw new Exception($e->getMessage());
     }
 }
 public function getindividualComprehensive($examinee_id)
 {
     $project_id = Examinee::findFirst($examinee_id)->project_id;
     $project_detail = ProjectDetail::findFirst(array("project_id = :project_id:", 'bind' => array('project_id' => $project_id)));
     if (empty($project_detail) || empty($project_detail->module_names)) {
         throw new Exception('项目配置信息有误');
     }
     $exist_module_array = explode(',', $project_detail->module_names);
     $module_array = array("心理健康" => 'mk_xljk', "素质结构" => 'mk_szjg', "智体结构" => 'mk_ztjg', "能力结构" => 'mk_nljg');
     $module_array_score = array();
     foreach ($module_array as $key => $value) {
         if (!in_array($value, $exist_module_array)) {
             continue;
         }
         $module_record = Module::findFirst(array("name = ?1", 'bind' => array(1 => $value)));
         $children = $module_record->children;
         $children_array = explode(',', $children);
         $result_1 = $this->modelsManager->createBuilder()->columns(array('Index.chs_name as chs_name', 'Index.name as name', 'IndexAns.score as score', 'Index.children as children'))->from('Index')->inwhere('Index.name', $children_array)->join('IndexAns', 'IndexAns.index_id = Index.id AND IndexAns.examinee_id = ' . $examinee_id)->orderBy('IndexAns.score desc')->getQuery()->execute()->toArray();
         //进行规范排序
         $module_array_score[$key] = array();
         foreach ($result_1 as &$result_1_record) {
             $skey = array_search($result_1_record['name'], $children_array);
             $module_array_score[$key][$skey] = $result_1_record;
         }
         //对指标层进行遍历查找中间层,以及children
         foreach ($module_array_score[$key] as &$index_info) {
             $middle = array();
             $middle = MiddleLayer::find(array('father_chs_name=?1', 'bind' => array(1 => $index_info['chs_name'])))->toArray();
             $children = array();
             $index_info['count'] = count(explode(',', $index_info['children']));
             $children = $this->getChildrenOfIndexDesc($index_info['name'], $index_info['children'], $examinee_id);
             $tmp = array();
             $children = $this->foo($children, $tmp);
             $tmp_detail = array();
             foreach ($middle as $middle_info) {
                 $outter_tmp = array();
                 $middle_children = explode(',', $middle_info['children']);
                 $outter_tmp_score = 0;
                 foreach ($middle_children as $children_name) {
                     $skey = array_search($children_name, $children);
                     $inner_tmp = array();
                     $inner_tmp['name'] = $children_name;
                     $inner_tmp['score'] = $children[$skey + 1];
                     $outter_tmp_score += $inner_tmp['score'];
                     $tmp_detail[] = $inner_tmp;
                 }
                 $outter_tmp['name'] = null;
                 $outter_tmp['score'] = $outter_tmp_score;
                 $tmp_detail[] = $outter_tmp;
             }
             $index_info['detail'] = $tmp_detail;
         }
     }
     return $module_array_score;
 }
 public function getComprehensiveData($project_id)
 {
     $this->project_check($project_id);
     #判断项目详细信息中是否有职业素质相关的模块
     $project_detail = ProjectDetail::findFirst(array("project_id = :project_id:", 'bind' => array('project_id' => $project_id)));
     if (empty($project_detail) || empty($project_detail->module_names)) {
         throw new Exception('项目配置信息有误');
     }
     $exist_module_array = explode(',', $project_detail->module_names);
     $module_array = array("心理健康" => 'mk_xljk', "素质结构" => 'mk_szjg', "智体结构" => 'mk_ztjg', "能力结构" => 'mk_nljg');
     $module_name_array = array("心理健康" => '职业心理', "素质结构" => '职业素质', "智体结构" => '智体结构', "能力结构" => '职业能力');
     $module_array_score = array();
     foreach ($module_array as $key => $value) {
         if (!in_array($value, $exist_module_array)) {
             continue;
         }
         $module_record = Module::findFirst(array("name = ?1", 'bind' => array(1 => $value)));
         $children = $module_record->children;
         $children_array = explode(',', $children);
         //获取某项模块下所有指标的平均分
         $result_1 = $this->modelsManager->createBuilder()->columns(array('AVG(IndexAns.score) as score', 'Index.chs_name as chs_name', 'Index.id as id'))->from('Examinee')->join('IndexAns', 'IndexAns.examinee_id = Examinee.id AND Examinee.type = 0 AND Examinee.project_id = ' . $project_id)->join('Index', 'Index.id = IndexAns.index_id')->inwhere('Index.name', $children_array)->groupBy('Index.name')->orderBy('AVG(IndexAns.score) desc')->getQuery()->execute();
         $tmp = array();
         $tmp['children'] = $result_1->toArray();
         $count = count($result_1);
         $sum = 0;
         foreach ($tmp['children'] as &$svalue) {
             $sum += sprintf('%.2f', $svalue['score']);
         }
         if ($count == 0) {
             throw new Exception('系统错误-模块下属指标的数量为0');
         }
         $tmp['value'] = sprintf('%.2f', $sum / $count);
         $tmp['name'] = $module_name_array[$key];
         $tmp['name_in_table'] = $value;
         $module_array_score[] = $tmp;
     }
     return $module_array_score;
 }
 public function getmoduleAction()
 {
     $manager = $this->session->get('Manager');
     if ($manager) {
         $result = array();
         $result['state'] = false;
         $result['ans'] = null;
         $project_detail = ProjectDetail::findFirst(array("project_id=?1", "bind" => array(1 => $manager->project_id)));
         if (!isset($project_detail->project_id)) {
             $this->dataReturn(array('success' => $result));
             return;
         }
         $module_name = array();
         $module_names = $project_detail->module_names;
         $module_name = explode(',', $module_names);
         if (empty($module_name)) {
             $this->dataReturn(array('success' => $result));
             return;
         }
         $ans = array();
         foreach ($module_name as $name) {
             $module = Module::findFirst(array('name=?1', 'bind' => array(1 => $name)));
             $ans[] = $module->chs_name;
         }
         $result['state'] = true;
         $result['ans'] = implode('|', $ans);
         $this->dataReturn(array("success" => $result));
         return;
     } else {
         $this->dataReturn(array('error' => "您的身份验证出错,请重新登录"));
         return;
     }
 }
Beispiel #5
0
 public function actionCreatelistuser()
 {
     $pj = ProjectDetail::model()->find("project_id = {$_REQUEST['pid']} and worker_id = {$_REQUEST['worker']} ");
     if (count($pj) == 0) {
         // ProjectDetail::model()->deleteAll("worker_id = $_REQUEST[worker]" );
         $model = new ProjectDetail();
         $model->project_id = $_REQUEST['pid'];
         $model->worker_id = $_REQUEST['worker'];
         $model->task_id = 0;
         $model->doing = 1;
         if ($model->save()) {
             echo "sukses";
         } else {
             echo "no";
         }
     } else {
         echo "no";
     }
     // $this->renderPartial('add-list-user');
 }
 public static function getSPMdata($examinee_info)
 {
     $projectdetail = ProjectDetail::findFirst(array('project_id=?1', 'bind' => array(1 => $examinee_info->project_id)));
     $factors = json_decode($projectdetail->factor_names, true);
     if (!isset($factors['SPM'])) {
         return null;
     }
     $ans = array();
     foreach ($factors['SPM'] as $key => $value) {
         $inner_array = array();
         $factor_info = Factor::findFirst($key);
         $inner_array['chs_name'] = $factor_info->chs_name;
         $factor_score_info = FactorAns::findFirst(array('factor_id = ?1 AND examinee_id =?2', 'bind' => array(1 => $key, 2 => $examinee_info->id)));
         $inner_array['std_score'] = intval($factor_score_info->std_score);
         $inner_array['score'] = $factor_score_info->score;
         //$inner_array['name'] = $factor_info->name;
         $ans[$factor_info->name] = $inner_array;
     }
     return $ans;
 }
Beispiel #7
0
		<?php 
    }
    ?>
	</td>
	&nbsp;
	<td colspan="3" align="center" style="width:auto;"  >
		<?php 
    if ($level == 1 or $level == 2) {
        ?>
			
			
			
			
<table style="margin-top:2px;">
<?php 
        $detail = ProjectDetail::model()->findAll("t.project_id = {$de['id']} ");
        $no = 1;
        $total = count($detail);
        foreach ($detail as $d) {
            $img = Team::model()->findByPk($d->worker_id)->image;
            ?>
<tr class="additional-team" <?php 
            //if ($no==$total) echo "style='border-bottom:1px solid black'"
            ?>
 >	


	<!-- row for user -->
	<td style="width:90px;">
		<?php 
            //if ($level==1):
Beispiel #8
0
		<?php 
if (User::model()->findByPk(Yii::app()->user->id)->level == 2) {
    ?>
		<div  id="sp">
			<div class="left">
				<br>
				<b style="font-size:20px">WORKING ON</b>
				<br>
				<p style="text-transform:uppercase" class="project-name" >
				<?php 
    // echo Yii::app()->user->id;
    $userid = Team::model()->find("username='******'")->id;
    // $userid;
    $pd = ProjectDetail::model()->find("worker_id='{$userid}'")->project_id;
    // echo $pd;
    echo Project::model()->findByPk($pd)->project_name;
    ?>
</p>
			</div>
			<div class="right">
			<?php 
    $liststatus = Task::model()->findAll();
    $id = Yii::app()->user->id;
    $idt = Team::model()->find("username = '******'")->id;
    $idp = Project::model()->find("worker={$idt} and status!=5")->id;
    $name = Project::model()->find("worker={$idt} and status!=5")->username;
    $ids = Project::model()->find("worker={$idt} and status!=5")->task;
    ?>
				<br>
				<b style="font-size:20px;display:none;">set by : (<?php 
    echo $name;
 /**
  * @type: 多次更改
  * @method $rt->module_names, $rt->index_names, $rt->factor_names, $rt->exam_json; ok
  * @usage 用于缓存通过project_id获取到的ProjectDetail表中的数据
  * @return \Phalcon\Mvc\Model\Resultset\Simple
  * @param int $project_id
  */
 public static function getProjectDetail($project_id)
 {
     self::checkConnect();
     return ProjectDetail::findFirst(array("project_id = :project_id:", 'bind' => array('project_id' => $project_id), 'hydration' => \Phalcon\Mvc\Model\Resultset\Simple::HYDRATE_ARRAYS, 'cache' => array('key' => 'project_detail_id_' . $project_id)));
 }
Beispiel #10
0
<?php

$detail = ProjectDetail::model()->findAll("t.project_id = {$id} ");
$no = 1;
foreach ($detail as $d) {
    ?>
<tr>
	<?php 
    ?>
	<td style="width:20px"><?php 
    echo $no;
    ?>
</td>
	<td>
		<?php 
    $img = Team::model()->findByPk($d->worker_id)->image;
    ?>
		<img src="<?php 
    echo Yii::app()->request->baseUrl;
    ?>
/img/icon-team/<?php 
    echo $img;
    ?>
" >
	<!--
	<select class="select-user" name="payments" style="width:250px;">
		<option value="0" >select user</option>
	<?php 
    $user = Project::model()->findByPk($de[id])->worker;
    foreach (Team::model()->findAll() as $tim) {
        ?>
Beispiel #11
0
				</tr>
			</table>
		<h1>
			PROJECT 3D ARTISTS
		</h1>
		<?php 
$data = Project::model()->findByPk($_REQUEST['id']);
?>
			<table>
				<tr>
					<td class="name"> No</td>
					<td class="value">Name</td>
				</tr>
				<?php 
$no = 1;
foreach (ProjectDetail::model()->findAll("t.project_id = '{$_REQUEST['id']}'") as $key) {
    ?>

				<tr>
					<td class="name"><?php 
    echo $no;
    ?>
</td>
					<td class="value"><?php 
    echo Team::model()->findByPk($key->worker_id)->name;
    ?>
</td>
				</tr>
				<?php 
    $no++;
}
 public function IsHidden($examinee_id)
 {
     $factor_name = 'epqal';
     $project_id = $this->self_check($examinee_id);
     //判断项目是否选中该因子
     $factor_id = '';
     $factor_info = ProjectDetail::findFirst(array("project_id = :project_id:", 'bind' => array('project_id' => $project_id)));
     $factor_names = json_decode($factor_info->factor_names, true);
     if (isset($factor_names['EPQA'])) {
         if (!in_array($factor_name, $factor_names['EPQA'])) {
             return true;
         } else {
             $new_array = array_flip($factor_names['EPQA']);
             $factor_id = $new_array[$factor_name];
         }
     } else {
         return true;
     }
     //存在的情况下进行项目整体判断
     $result = $this->modelsManager->createBuilder()->columns(array('avg(FactorAns.score) as avg'))->from('Examinee')->join('FactorAns', 'Examinee.id = FactorAns.examinee_id and  Examinee.project_id = ' . $project_id)->join('Factor', "Factor.id = FactorAns.factor_id AND Factor.name = '{$factor_name}'")->getQuery()->execute();
     $average = $result->toArray()[0]['avg'];
     $result = FactorAns::findFirst(array('factor_id = ?1 AND examinee_id = ?2', 'bind' => array(1 => $factor_id, 2 => $examinee_id)));
     $person_score = $result->score;
     if ($person_score <= $average) {
         return true;
     } else {
         return false;
     }
 }