public function perform_action()
 {
     PC_DAO::get_projects()->create(new PC_Project(1, '', time(), '', '', '', '', false));
     $this->set_redirect(false);
     $this->set_show_status_page(false);
     $this->set_action_performed(true);
     return '';
 }
 public function perform_action()
 {
     $input = FWS_Props::get()->input();
     $pid = $input->get_var('id', 'get', FWS_Input::INTEGER);
     if ($pid == null) {
         return '';
     }
     if ($input->isset_var('add', 'post')) {
         $type = $input->correct_var('add_type', 'post', FWS_Input::STRING, array('min', 'max'), 'min');
         $name = $input->get_var('add_name', 'post', FWS_Input::STRING);
         $version = $input->get_var('add_version', 'post', FWS_Input::STRING);
         if ($name == '') {
             return 'Please specify the name of the component';
         }
         if ($version == '') {
             return 'Please specify the version';
         }
         PC_DAO::get_projects()->add_req($pid, $type, $name, $version);
     } else {
         $name = $input->get_var('name', 'post', FWS_Input::STRING);
         $start_day = $input->get_var('start_day', 'post', FWS_Input::INTEGER);
         $start_month = $input->get_var('start_month', 'post', FWS_Input::INTEGER);
         $start_year = $input->get_var('start_year', 'post', FWS_Input::INTEGER);
         $start = mktime(0, 0, 0, $start_month, $start_day, $start_year);
         $projdeps = $input->get_var('projdeps', 'post');
         $report_argret_strictly = $input->isset_var('report_argret_strictly', 'post');
         $edit_type = $input->get_var('edit_type', 'post');
         $edit_name = $input->get_var('edit_name', 'post');
         $edit_version = $input->get_var('edit_version', 'post');
         $proj = PC_DAO::get_projects()->get_by_id($pid);
         if (!$proj) {
             return '';
         }
         if ($name == '') {
             return 'Please specify the project name';
         }
         $proj->set_name($name);
         $proj->set_created($start);
         $proj->set_report_argret_strictly($report_argret_strictly);
         $proj->set_project_deps(is_array($projdeps) ? array_keys($projdeps) : array());
         $req = $proj->get_req();
         foreach ($req as &$r) {
             $r['type'] = $edit_type[$r['id']];
             $r['name'] = $edit_name[$r['id']];
             $r['version'] = $edit_version[$r['id']];
         }
         $proj->set_req($req);
         PC_DAO::get_projects()->update($proj);
     }
     $this->set_success_msg('The version has been added');
     $this->set_redirect(true, PC_URL::get_mod_url('edit_project')->set('id', $pid));
     $this->set_show_status_page(false);
     $this->set_action_performed(true);
     return '';
 }
 public function perform_action()
 {
     $input = FWS_Props::get()->input();
     $pid = $input->get_var('project', 'post', FWS_Input::INTEGER);
     if ($pid < 0) {
         return 'Invalid project-id';
     }
     PC_DAO::get_projects()->set_current($pid);
     $this->set_action_performed(true);
     $this->set_show_status_page(false);
     $this->set_redirect(false);
     return '';
 }
 public function perform_action()
 {
     $input = FWS_Props::get()->input();
     $pid = $input->get_var('id', 'get', FWS_Input::INTEGER);
     $vid = $input->get_var('vid', 'get', FWS_Input::INTEGER);
     if ($pid == null || $vid == null) {
         return TDL_GENERAL_ERROR;
     }
     PC_DAO::get_projects()->del_req($vid);
     $this->set_success_msg('The requirement has been deleted');
     $this->set_redirect(true, PC_URL::get_mod_url('edit_project')->set('id', $pid));
     $this->set_show_status_page(false);
     $this->set_action_performed(true);
     return '';
 }
 public function perform_action()
 {
     $input = FWS_Props::get()->input();
     $user = FWS_Props::get()->user();
     $folderstr = $input->get_var('folders', 'post', FWS_Input::STRING);
     $exclstr = $input->get_var('exclude', 'post', FWS_Input::STRING);
     $files = array();
     $folders = FWS_Array_Utils::advanced_explode("\n", $folderstr);
     $excl = FWS_Array_Utils::advanced_explode("\n", $exclstr);
     FWS_Array_Utils::trim($excl);
     // determine files to scan
     foreach ($folders as $folder) {
         $folder = trim($folder);
         if (is_file($folder)) {
             $files[] = $folder;
         } else {
             foreach (FWS_FileUtils::get_list($folder, true, true) as $item) {
                 if (!$this->is_excluded($item, $excl)) {
                     $files[] = $item;
                 }
             }
         }
     }
     // clear position, just to be sure
     $storage = new FWS_Progress_Storage_Session('ptypescan_');
     $storage->clear();
     // store in session
     $user->set_session_data('typescan_files', $files);
     // store in project
     $project = FWS_Props::get()->project();
     $project->set_type_folders($folderstr);
     $project->set_type_exclude($exclstr);
     PC_DAO::get_projects()->update($project);
     // clear previous data in the db
     PC_DAO::get_classes()->delete_by_project($project->get_id());
     PC_DAO::get_functions()->delete_by_project($project->get_id());
     PC_DAO::get_constants()->delete_by_project($project->get_id());
     PC_DAO::get_classfields()->delete_by_project($project->get_id());
     PC_DAO::get_errors()->delete_by_type(PC_Obj_Error::get_types_of(PC_Obj_Error::R_TYPESCANNER), $project->get_id());
     $this->set_redirect(true, PC_URL::get_submod_url(0, 'cliscan'));
     $this->set_show_status_page(false);
     $this->set_action_performed(true);
     return '';
 }
Beispiel #6
0
 /**
  * @see FWS_Module::run()
  */
 public function run()
 {
     $input = FWS_Props::get()->input();
     $tpl = FWS_Props::get()->tpl();
     $id = $input->get_var('id', 'get', FWS_Input::INTEGER);
     if ($id === null) {
         $this->report_error();
         return;
     }
     $add_type = $input->correct_var('add_type', 'post', FWS_Input::STRING, array('min', 'max'), 'min');
     $add_name = $input->get_var('add_name', 'post', FWS_Input::STRING);
     $add_version = $input->get_var('add_version', 'post', FWS_Input::STRING);
     $proj = PC_DAO::get_projects()->get_by_id($id);
     if ($proj === null) {
         $this->report_error();
         return;
     }
     $target_url = PC_URL::get_mod_url();
     $target_url->set('id', $id);
     $this->request_formular();
     $req = $proj->get_req();
     if (!is_array($req)) {
         $req = array();
     }
     foreach ($req as &$r) {
         $del_url = clone $target_url;
         $del_url->set('vid', $r['id']);
         $del_url->set('aid', PC_ACTION_DELETE_REQ);
         $r['del_url'] = $del_url->to_url();
     }
     $projects = array();
     foreach (PC_DAO::get_projects()->get_all() as $p) {
         if ($p->get_id() == $proj->get_id()) {
             continue;
         }
         $projects[] = array('id' => $p->get_id(), 'value' => in_array($p->get_id(), $proj->get_project_deps()), 'name' => $p->get_name());
     }
     $tpl->add_variables(array('target_url' => $target_url->to_url(), 'action_type' => PC_ACTION_EDIT_PROJECT, 'def_name' => $proj->get_name(), 'def_start' => $proj->get_created(), 'projects' => $projects, 'report_argret_strictly' => $proj->get_report_argret_strictly(), 'req' => $req, 'add_type' => $add_type, 'add_name' => $add_name, 'add_version' => $add_version, 'types' => array('min' => '&gt;=', 'max' => '&lt;'), 'add_req_url' => $target_url->set('aid', PC_ACTION_ADD_REQ)->to_url()));
 }
 public function perform_action()
 {
     $input = FWS_Props::get()->input();
     $idstr = $input->get_var('ids', 'get', FWS_Input::STRING);
     $ids = FWS_Array_Utils::advanced_explode(',', $idstr);
     if (!FWS_Array_Utils::is_numeric($ids)) {
         return 'Got an invalid id-string';
     }
     PC_DAO::get_projects()->delete($ids);
     foreach ($ids as $id) {
         PC_DAO::get_calls()->delete_by_project($id);
         PC_DAO::get_classes()->delete_by_project($id);
         PC_DAO::get_classfields()->delete_by_project($id);
         PC_DAO::get_constants()->delete_by_project($id);
         PC_DAO::get_errors()->delete_by_project($id);
         PC_DAO::get_functions()->delete_by_project($id);
         PC_DAO::get_vars()->delete_by_project($id);
     }
     $this->set_redirect(false);
     $this->set_show_status_page(false);
     $this->set_action_performed(true);
     return '';
 }
Beispiel #8
0
 /**
  * @see FWS_Document_Renderer_HTML_Default::header()
  */
 protected function header()
 {
     $tpl = FWS_Props::get()->tpl();
     $this->get_action_performer()->add_action(new PC_Action_chgproject(PC_ACTION_CHG_PROJECT));
     $this->perform_action();
     $projects = PC_DAO::get_projects()->get_all();
     $pronames = array();
     $pronames[0] = 'PHP builtins';
     foreach ($projects as $project) {
         $pronames[$project->get_id()] = $project->get_name();
     }
     $form = new FWS_HTML_Formular();
     $tpl->set_template('inc_header.htm');
     $tpl->add_allowed_method('form', '*');
     $tpl->add_variables(array('location' => $this->get_breadcrumb_links(), 'form' => $form, 'projects' => $pronames, 'chg_project_aid' => PC_ACTION_CHG_PROJECT, 'project' => FWS_Props::get()->project() !== null ? FWS_Props::get()->project()->get_id() : 0));
     $tpl->restore_template();
 }
 /**
  * @return PC_Project the current project
  */
 protected function project()
 {
     return PC_DAO::get_projects()->get_current();
 }