示例#1
0
 public static function get_instance()
 {
     if (!self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
示例#2
0
 private function _ajax_oplog()
 {
     $pid = intval($this->_param['pid']);
     $log = Biz_OperateLog::get_instance()->get_newest_log($pid, 100);
     $op_explain = APF::get_instance()->get_config('op_explain');
     $status = APF::get_instance()->get_config("op_status", "script_error");
     $html = "";
     foreach ($log as $l) {
         //hide copy cmd
         if ($l->op != 3 && $l->op != 4) {
             $html .= "<tr>";
             $html .= "<td>{$l->user->cname}</td>";
             $html .= "<td>{$op_explain[$l->op]}</td>";
             if ($l->cmd->status > 1) {
                 $html .= "<td style='color:red'>{$status[$l->cmd->status]}</td>";
             } else {
                 $html .= "<td>{$status[$l->cmd->status]}</td>";
             }
             $html .= "<td>{$l->desc}</td>";
             $html .= "<td>{$l->param}</td>";
             $html .= "<td>{$l->creation}</td>";
             $html .= "</tr>";
         }
     }
     echo $html;
     exit;
 }
示例#3
0
 private function _compare()
 {
     if (empty($this->_param['pid'])) {
         return $this->_choose_project();
     }
     $pid = intval($this->_param['pid']);
     $project = Biz_Project::get_instance()->get_info($pid);
     $synclog = Biz_OperateLog::get_instance()->get_newest_sync_version($pid, 30);
     $v1 = !empty($this->_param['v1']) ? $this->_param['v1'] : '';
     $v2 = !empty($this->_param['v2']) ? $this->_param['v2'] : '';
     $tv1 = explode(';;;', $v1);
     $tv2 = explode(';;;', $v2);
     $diff = $this->_get_diff_file($project, $tv1[0], $tv2[0]);
     //$this->_request->set_attribute('message', $this->_message);
     $this->_request->set_attribute('diff', $diff);
     $this->_request->set_attribute('project', $project);
     $this->_request->set_attribute('synclog', $synclog);
     $this->_request->set_attribute('v1', $v1);
     $this->_request->set_attribute('v2', $v2);
     $this->_request->set_attribute('page_title', $project->name . '&nbsp;&nbsp;&nbsp;文件对比');
     $this->_request->set_attribute('viewpage', 'version/compare');
     $this->_request->set_attribute('menu_id', 3);
     return "Abstract";
 }
示例#4
0
 private function _switch()
 {
     $pid = intval($this->_param['pid']);
     $param = isset($this->_param['param']) ? trim($this->_param['param']) : '';
     $desc = isset($this->_param['desc']) ? trim($this->_param['desc']) : '';
     $project = Biz_Project::get_instance()->get_info($pid);
     $input = array();
     $input['pid'] = $pid;
     $input['user_id'] = $this->_user->id;
     $input['op'] = 2;
     $input['param'] = $param;
     $input['desc'] = $desc;
     $input['status'] = 0;
     $oplog_id = Biz_OperateLog::get_instance()->insert($input);
     $input['id'] = $oplog_id;
     Biz_Command::get_instance()->insert($input);
     Biz_Project::get_instance()->update($pid, array('pversion' => $project->version, 'version' => $param));
     $this->_response->redirect(PageHelper::get_domain() . '/project/op?pid=' . $pid);
 }