示例#1
0
 /**
  * @see FWS_Module::run()
  */
 public function run()
 {
     $input = FWS_Props::get()->input();
     $functions = FWS_Props::get()->functions();
     $id_str = $input->get_var('ids', 'get', FWS_Input::STRING);
     $loc = $input->get_var('loc', 'get', FWS_Input::STRING);
     if (!$id_str || !$loc) {
         $this->report_error();
         return;
     }
     $ids = FWS_Array_Utils::advanced_explode(',', $id_str);
     if (FWS_Array_Utils::is_numeric($ids)) {
         switch ($loc) {
             case 'view_projects':
                 $table = TDL_TB_PROJECTS;
                 $field = 'project_name';
                 $yes_url = TDL_URL::get_mod_url('view_projects');
                 $yes_url->set(TDL_URL_AT, TDL_ACTION_DELETE_PROJECTS);
                 $yes_url->set(TDL_URL_IDS, implode(',', $ids));
                 $yes_url = $yes_url->to_url();
                 break;
             case 'view_entries':
                 $table = TDL_TB_ENTRIES;
                 $field = 'entry_title';
                 $yes_url = TDL_URL::get_mod_url(-1);
                 $yes_url->set(TDL_URL_AT, TDL_ACTION_DELETE_ENTRIES);
                 $yes_url->set(TDL_URL_IDS, implode(',', $ids));
                 $yes_url = $yes_url->to_url();
                 break;
         }
         $no_url = 'javascript:FWS_hideElement(\\\'delete_message_box\\\');';
         $functions->add_entry_delete_message($ids, $table, $field, $yes_url, $no_url);
     }
 }
示例#2
0
 /**
  * @see FWS_Module::run()
  */
 public function run()
 {
     $tpl = FWS_Props::get()->tpl();
     $input = FWS_Props::get()->input();
     $cookies = FWS_Props::get()->cookies();
     $file = $input->get_var('file', -1, FWS_Input::STRING);
     $msg = $input->get_var('msg', -1, FWS_Input::STRING);
     $types = $input->get_var('types', -1);
     if (!FWS_Array_Utils::is_numeric($types)) {
         $types = array();
     }
     $url = PC_URL::get_mod_url();
     $url->set('file', $file);
     $url->set('msg', $msg);
     if (count($types)) {
         $url->set('types', $types);
     }
     $surl = clone $url;
     $pagination = new PC_Pagination(PC_ENTRIES_PER_PAGE, PC_DAO::get_errors()->get_count_with($file, $msg, $types));
     $pagination->populate_tpl($url);
     $start = $pagination->get_start();
     $errs = array();
     $errors = PC_DAO::get_errors()->get_list(PC_Project::CURRENT_ID, $start, PC_ENTRIES_PER_PAGE, $file, $msg, $types);
     foreach ($errors as $err) {
         /* @var $err PC_Obj_Error */
         $url = PC_URL::get_mod_url('file');
         $url->set('path', $err->get_loc()->get_file());
         $url->set('line', $err->get_loc()->get_line());
         $url->set_anchor('l' . $err->get_loc()->get_line());
         $errs[] = array('id' => $err->get_id(), 'type' => PC_Obj_Error::get_type_name($err->get_type()), 'message' => $this->get_msg($err), 'file' => $err->get_loc()->get_file(), 'line' => $err->get_loc()->get_line(), 'fileurl' => $url->to_url(), 'typeurl' => PC_URL::get_mod_url()->set('types', array($err->get_type()))->to_url());
     }
     $this->request_formular();
     $typecbs = array();
     $row = -1;
     $i = 0;
     $error_types = PC_Obj_Error::get_types();
     asort($error_types);
     foreach ($error_types as $type => $name) {
         if ($i % 4 == 0) {
             $typecbs[++$row] = array();
         }
         $typecbs[$row][] = array('name' => 'types[' . $type . ']', 'selected' => count($types) == 0 || in_array($type, $types), 'value' => $type, 'text' => $name);
         $i++;
     }
     for ($i = $i % 4; $i < 4; $i++) {
         $typecbs[$row][] = array('name' => '');
     }
     $callurl = PC_URL::get_mod_url('filepart');
     $callurl->set('id', '__ID__');
     $callurl->set('type', 'error');
     $tpl->add_variables(array('errors' => $errs, 'search_target' => $surl->to_url(), 'display_search' => $cookies->get_cookie('error_search') ? 'block' : 'none', 'cookie_name' => $cookies->get_prefix() . 'error_search', 'file' => $file, 'msg' => $msg, 'typecbs' => $typecbs, 'get_code_url' => $callurl->to_url()));
 }
 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 '';
 }
 public function perform_action()
 {
     $input = FWS_Props::get()->input();
     $locale = FWS_Props::get()->locale();
     $id_str = $input->get_predef(TDL_URL_IDS, 'get');
     $ids = FWS_Array_Utils::advanced_explode(',', $id_str);
     if (!FWS_Array_Utils::is_numeric($ids) || count($ids) == 0) {
         return TDL_GENERAL_ERROR;
     }
     // read variables from post
     $status = $input->correct_var('status', 'post', FWS_Input::STRING, array('open', 'fixed', 'running', 'not_tested', 'not_reproducable', 'need_info'), 'open');
     $fixed_version = $input->get_var('fixed_version', 'post', FWS_Input::STRING);
     if ($status == 'fixed') {
         @(list(, $fixed_version_id) = explode(',', $fixed_version));
         $fixed_date = time();
     } else {
         $fixed_date = 0;
         $fixed_version_id = 0;
     }
     // update entries
     foreach ($ids as $id) {
         // build object
         $entry = new TDL_Objects_Entry(TDL_TB_ENTRIES);
         $entry->set_id($id);
         $entry->set_entry_status($status);
         $entry->set_entry_fixed_version($fixed_version_id);
         $entry->set_entry_fixed_date($fixed_date);
         $entry->set_entry_changed_date(time());
         // write to db
         if (!$entry->check('update')) {
             return $entry->errors();
         }
         $entry->update();
     }
     $this->set_show_status_page(false);
     $this->set_success_msg($locale->_('The status has been changed successfully'));
     $this->set_action_performed(true);
     $this->set_redirect(true, TDL_URL::get_mod_url(-1));
     return '';
 }
示例#5
0
    /**
     * Returns all fields of the given class
     *
     * @param array $cids the class ids
     * @param int $pid the project-id (default = current)
     * @return array an array of PC_Obj_Field objects
     */
    public function get_all($cids, $pid = PC_Project::CURRENT_ID)
    {
        $db = FWS_Props::get()->db();
        if (!FWS_Array_Utils::is_integer($cids)) {
            FWS_Helper::def_error('intarray', 'cids', $cids);
        }
        if (count($cids) == 0) {
            return array();
        }
        $stmt = $db->get_prepared_statement('SELECT * FROM ' . PC_TB_CLASS_FIELDS . '
			 WHERE project_id = :pid AND class IN (:cids)');
        $stmt->bind(':pid', PC_Utils::get_project_id($pid));
        $stmt->bind(':cids', $cids);
        $fields = array();
        $rows = $db->get_rows($stmt->get_statement());
        foreach ($rows as $row) {
            $field = new PC_Obj_Field($row['file'], $row['line'], $row['name'], unserialize($row['type']), $row['visibility'], $row['class']);
            $field->set_static($row['static']);
            $fields[] = $field;
        }
        return $fields;
    }
示例#6
0
    /**
     * @see FWS_Module::run()
     */
    public function run()
    {
        $input = FWS_Props::get()->input();
        $db = FWS_Props::get()->db();
        $functions = FWS_Props::get()->functions();
        $versions = FWS_Props::get()->versions();
        $tpl = FWS_Props::get()->tpl();
        $id_str = $input->get_predef(TDL_URL_IDS, 'get');
        $ids = FWS_Array_Utils::advanced_explode(',', $id_str);
        if (!FWS_Array_Utils::is_numeric($ids)) {
            $this->report_error();
            return;
        }
        $this->request_formular();
        $projects = array();
        $id_str = FWS_Array_Utils::advanced_implode(',', $ids);
        $entries = array();
        $rows = $db->get_rows('SELECT id,project_id,entry_title,entry_status FROM ' . TDL_TB_ENTRIES . '
			 WHERE id IN (' . $id_str . ')');
        foreach ($rows as $data) {
            if (!isset($projects[$data['project_id']])) {
                $projects[$data['project_id']] = true;
            }
            $entries[] = array('title' => $data['entry_title'], 'status' => $functions->get_status_text($data['entry_status']));
        }
        $version_options = array('&nbsp;');
        $rows = $versions->get_elements();
        usort($rows, array($functions, 'sort_versions_by_name_callback'));
        foreach ($rows as $row) {
            if (isset($projects[$row['project_id']])) {
                $version_options[$row['project_id'] . ',' . $row['id']] = $row['project_name'] . ' ' . $row['version_name'];
            }
        }
        next($version_options);
        $def_version = key($version_options);
        reset($version_options);
        $tpl->add_variables(array('ids' => $id_str, 'action_type' => TDL_ACTION_CHANGE_STATUS, 'status' => $functions->get_states(false), 'versions' => $version_options, 'def_version' => $def_version, 'entries' => $entries));
    }
 public function perform_action()
 {
     $input = FWS_Props::get()->input();
     $locale = FWS_Props::get()->locale();
     $id_str = $input->get_predef(TDL_URL_IDS, 'get');
     $ids = FWS_Array_Utils::advanced_explode(',', $id_str);
     if (!FWS_Array_Utils::is_numeric($ids) || count($ids) == 0) {
         return TDL_GENERAL_ERROR;
     }
     // delete the entries
     foreach ($ids as $id) {
         $entry = new TDL_Objects_Entry(TDL_TB_ENTRIES);
         $entry->set_id($id);
         if (!$entry->check('delete')) {
             return $entry->errors();
         }
         $entry->delete();
     }
     $this->set_success_msg($locale->_('The entries have been deleted successfully'));
     $this->set_redirect(false);
     $this->set_action_performed(true);
     return '';
 }
 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 '';
 }
示例#9
0
 /**
  * The default method. This generates an URL with given parameters and returns it.
  * The extern-variables (if you want it) and the session-id (if necessary)
  * will be appended.
  * The file will be <var>$_SERVER['PHP_SELF']</var>.
  *
  * @param string|int $target the action-parameter (0 = current, -1 = none)
  * @param string $additional additional parameters
  * @param string $separator the separator of the params (default is &amp;)
  * @return string the url
  */
 private static function get_url($target = 0, $additional = '', $separator = '&amp;')
 {
     $url = new TDL_URL();
     $url->set_separator($separator);
     $input = FWS_Props::get()->input();
     // add action
     $action_param = $input->get_var(TDL_URL_ACTION, 'get', FWS_Input::STRING);
     if ($target === 0 && $action_param !== null) {
         $url->set(TDL_URL_ACTION, $action_param);
     } else {
         if ($target !== -1) {
             $url->set(TDL_URL_ACTION, $target);
         } else {
             $url->set(TDL_URL_ACTION, 'view_entries');
         }
     }
     // add additional params
     foreach (FWS_Array_Utils::advanced_explode($separator, $additional) as $param) {
         @(list($k, $v) = explode('=', $param));
         $url->set($k, $v);
     }
     return $url->to_url();
 }
示例#10
0
 public function perform_action()
 {
     $input = FWS_Props::get()->input();
     $locale = FWS_Props::get()->locale();
     $id_str = $input->get_predef(TDL_URL_IDS, 'get');
     $ids = FWS_Array_Utils::advanced_explode(',', $id_str);
     if (!FWS_Array_Utils::is_numeric($ids) || count($ids) == 0) {
         return TDL_GENERAL_ERROR;
     }
     foreach ($ids as $id) {
         $project = new TDL_Objects_Project(TDL_TB_PROJECTS);
         $project->set_id($id);
         if (!$project->check('delete')) {
             return $project->errors();
         }
         $project->delete();
     }
     $this->set_success_msg($locale->_('The projects have been deleted'));
     $this->set_redirect(true, TDL_URL::get_mod_url('view_projects'));
     $this->add_link($locale->_('Back'), TDL_URL::get_mod_url('view_projects'));
     $this->set_action_performed(true);
     return '';
 }
示例#11
0
 /**
  * @see FWS_Module::run()
  */
 public function run()
 {
     $input = FWS_Props::get()->input();
     $functions = FWS_Props::get()->functions();
     $cfg = FWS_Props::get()->cfg();
     $db = FWS_Props::get()->db();
     $versions = FWS_Props::get()->versions();
     $cats = FWS_Props::get()->cats();
     $tpl = FWS_Props::get()->tpl();
     $mode = $input->correct_var(TDL_URL_MODE, 'get', FWS_Input::STRING, array('add', 'edit'), 'add');
     $id = $input->get_predef(TDL_URL_IDS, 'get');
     if ($id === null && $mode == 'edit') {
         $this->report_error();
         return;
     }
     $multiple = false;
     $base_url = TDL_URL::get_entry_url();
     $entries = array();
     $data = array('project_id' => $cfg['project_id'], 'entry_title' => '', 'entry_description' => '', 'entry_info_link' => '', 'entry_status' => $cfg['last_status'], 'entry_category' => $cfg['last_category'], 'entry_start_version' => $cfg['last_start_version'], 'entry_fixed_version' => $cfg['last_fixed_version'], 'entry_type' => $cfg['last_type'], 'entry_priority' => $cfg['last_priority']);
     $this->request_formular();
     if ($mode == 'edit') {
         $ids = FWS_Array_Utils::advanced_explode(',', $id);
         if (!FWS_Array_Utils::is_numeric($ids)) {
             $this->report_error();
             return;
         }
         $multiple = count($ids) > 1;
         if ($multiple) {
             $selected_entries = array();
             $rows = $db->get_rows('SELECT id,entry_title FROM ' . TDL_TB_ENTRIES . ' WHERE id IN (' . implode(',', $ids) . ')');
             foreach ($rows as $row) {
                 $selected_entries[] = $row['id'];
                 $entries[] = $row;
             }
             if (count($selected_entries) == 0) {
                 $this->report_error();
                 return;
             }
         } else {
             $id = (int) $id;
             if ($id <= 0) {
                 $this->report_error();
                 return;
             }
             $data = $db->get_row('SELECT * FROM ' . TDL_TB_ENTRIES . ' WHERE id = ' . $id);
             if ($data['id'] == '') {
                 $this->report_error();
                 return;
             }
         }
         $target_url = clone $base_url;
         $target_url->set(TDL_URL_ACTION, 'edit_entry');
         $target_url->set(TDL_URL_MODE, 'edit');
         $target_url->set(TDL_URL_IDS, $id);
         $action_type = TDL_ACTION_EDIT_ENTRY;
     } else {
         $target_url = clone $base_url;
         $target_url->set(TDL_URL_ACTION, 'edit_entry');
         $target_url->set(TDL_URL_MODE, 'add');
         $action_type = TDL_ACTION_NEW_ENTRY;
     }
     $version_options = array('&nbsp;');
     if ($cfg['project_id'] != 0) {
         $v_rows = $versions->get_elements_with(array('project_id' => $cfg['project_id']));
     } else {
         $v_rows = $versions->get_elements_with(array());
     }
     usort($v_rows, array($functions, 'sort_versions_by_name_callback'));
     foreach ($v_rows as $row) {
         $version_options[$row['project_id'] . ',' . $row['id']] = $row['project_name'] . ' ' . $row['version_name'];
     }
     $category_options = array('&nbsp;');
     if ($cfg['project_id'] != 0) {
         $cat_rows = $cats->get_elements_with(array('project_id' => $cfg['project_id']));
     } else {
         $cat_rows = $cats->get_elements_with(array());
     }
     foreach ($cat_rows as $row) {
         $project = $versions->get_element_with(array('project_id' => $row['project_id']));
         $category_options[$row['id']] = $project['project_name_short'] . ' :: ' . $row['category_name'];
     }
     $tpl->add_variables(array('not_multiple_edit' => !$multiple, 'mode' => $mode, 'selected_entries' => $entries, 'target_url' => $target_url->to_url(), 'action_type' => $action_type, 'def_title' => $data['entry_title'], 'def_description' => $data['entry_description'], 'def_info_link' => $data['entry_info_link'], 'start_version_combo' => $this->_get_combobox($multiple, 'start_version', $version_options, $data['project_id'] . ',' . $data['entry_start_version']), 'fixed_version_combo' => $this->_get_combobox($multiple, 'fixed_version', $version_options, $data['project_id'] . ',' . $data['entry_fixed_version']), 'category_combo' => $this->_get_combobox($multiple, 'category', $category_options, $data['entry_category']), 'status_combo' => $this->_get_combobox($multiple, 'status', $functions->get_states(false), $data['entry_status']), 'type_combo' => $this->_get_combobox($multiple, 'type', $functions->get_types(false), $data['entry_type']), 'priority_combo' => $this->_get_combobox($multiple, 'priority', $functions->get_priorities(false), $data['entry_priority']), 'back_url' => $base_url->to_url()));
 }
示例#12
0
    /**
     * Deletes the projects with given ids
     *
     * @param array $ids the ids
     * @return int the number of affected rows
     */
    public function delete($ids)
    {
        if (!FWS_Array_Utils::is_numeric($ids) || count($ids) == 0) {
            FWS_Helper::def_error('numarray>0', 'ids', $ids);
        }
        $db = FWS_Props::get()->db();
        $stmt = $db->get_prepared_statement('DELETE FROM ' . PC_TB_PROJECT_DEPS . '
			 WHERE project_id IN (:ids) OR dep_id IN (:ids)');
        $stmt->bind(':ids', $ids);
        $db->execute($stmt->get_statement());
        $stmt = $db->get_prepared_statement('DELETE FROM ' . PC_TB_PROJECTS . ' WHERE id IN (:ids)');
        $stmt->bind(':ids', $ids);
        $db->execute($stmt->get_statement());
        return $db->get_affected_rows();
    }
示例#13
0
    /**
     * Returns all functions
     *
     * @param array $cids the class ids (0 = free functions)
     * @param int $start the start-position (for the LIMIT-statement)
     * @param int $count the max. number of rows (for the LIMIT-statement) (0 = unlimited)
     * @param string $file the file-name to search for
     * @param string $name the function-name to search for
     * @param int $pid the project-id (current by default)
     * @return array all found functions
     */
    public function get_list($cids, $start = 0, $count = 0, $file = '', $name = '', $pid = PC_PRoject::CURRENT_ID)
    {
        $db = FWS_Props::get()->db();
        if (!FWS_Helper::is_integer($start) || $start < 0) {
            FWS_Helper::def_error('intge0', 'start', $start);
        }
        if (!FWS_Helper::is_integer($count) || $count < 0) {
            FWS_Helper::def_error('intge0', 'count', $count);
        }
        if (!FWS_Array_Utils::is_integer($cids)) {
            FWS_Helper::def_error('intarray', 'cids', $cids);
        }
        if (count($cids) == 0) {
            return array();
        }
        $funcs = array();
        $stmt = $db->get_prepared_statement('SELECT * FROM ' . PC_TB_FUNCTIONS . '
			 WHERE project_id = :pid AND class IN (:cids)
			 ' . ($file ? ' AND file LIKE :file' : '') . '
			 ' . ($name ? ' AND name LIKE :name' : '') . '
			 ORDER BY name
			 ' . ($count > 0 ? ' LIMIT :start,:count' : ''));
        $stmt->bind(':pid', PC_Utils::get_project_id($pid));
        $stmt->bind(':cids', $cids);
        if ($file) {
            $stmt->bind(':file', '%' . $file . '%');
        }
        if ($name) {
            $stmt->bind(':name', '%' . $name . '%');
        }
        if ($count > 0) {
            $stmt->bind(':start', $start);
            $stmt->bind(':count', $count);
        }
        $rows = $db->get_rows($stmt->get_statement());
        foreach ($rows as $row) {
            $funcs[] = $this->build_func($row);
        }
        return $funcs;
    }
示例#14
0
 public function perform_action()
 {
     $input = FWS_Props::get()->input();
     $functions = FWS_Props::get()->functions();
     $locale = FWS_Props::get()->locale();
     // check id
     $id = $input->get_predef(TDL_URL_IDS, 'get');
     if ($id == null) {
         return TDL_GENERAL_ERROR;
     }
     $ids = FWS_Array_Utils::advanced_explode(',', $id);
     if (count($ids) == 0) {
         return TDL_GENERAL_ERROR;
     }
     $multiple = count($ids) > 1;
     $time = time();
     if (!$multiple) {
         $title = $input->get_var('entry_title', 'post', FWS_Input::STRING);
         $description = $input->get_var('entry_description', 'post', FWS_Input::STRING);
         $info_link = $input->get_var('entry_info_link', 'post', FWS_Input::STRING);
     }
     $category = $input->get_var('category', 'post', FWS_Input::INTEGER);
     $start_version = $input->get_var('start_version', 'post', FWS_Input::STRING);
     $fixed_version = $input->get_var('fixed_version', 'post', FWS_Input::STRING);
     $status = $input->correct_var('status', 'post', FWS_Input::STRING, array('open', 'running', 'fixed', 'not_tested', 'not_reproducable', 'need_info'), 'open');
     $type = $input->correct_var('type', 'post', FWS_Input::STRING, array('bug', 'feature', 'improvement', 'test'), 'bug');
     $priority = $input->correct_var('priority', 'post', FWS_Input::STRING, array('current', 'next', 'anytime'), 'anytime');
     if ($multiple) {
         if (!$input->isset_var('use_start_version', 'post')) {
             $start_version = 0;
         }
         if (!$input->isset_var('use_fixed_version', 'post')) {
             $fixed_version = 0;
         }
         if (!$input->isset_var('use_category', 'post')) {
             $category = 0;
         }
     }
     if (!$multiple || $input->isset_var('use_start_version', 'post')) {
         @(list($start_project_id, $start_version_id) = explode(',', $start_version));
     }
     if ($fixed_version == 0 || $status != 'fixed') {
         $fixed_date = 0;
         $fixed_version_id = 0;
     } else {
         @(list(, $fixed_version_id) = explode(',', $fixed_version));
         $fixed_date = $time;
     }
     // update entries
     foreach ($ids as $id) {
         $entry = new TDL_Objects_Entry(TDL_TB_ENTRIES);
         $entry->set_id($id);
         if (isset($start_project_id)) {
             $entry->set_project_id($start_project_id);
         }
         if (!$multiple) {
             $entry->set_entry_title($title);
             $entry->set_entry_description($description);
             $entry->set_entry_info_link($info_link);
         }
         if (!$multiple || $input->isset_var('use_start_version', 'post')) {
             $entry->set_entry_start_version($start_version_id);
         }
         if (!$multiple || $input->isset_var('use_fixed_version', 'post')) {
             $entry->set_entry_fixed_version($fixed_version_id);
             $entry->set_entry_fixed_date($fixed_date);
         }
         if (!$multiple || $input->isset_var('use_category', 'post')) {
             $entry->set_entry_category($category);
         }
         if (!$multiple || $input->isset_var('use_status', 'post')) {
             $entry->set_entry_status($status);
         }
         if (!$multiple || $input->isset_var('use_type', 'post')) {
             $entry->set_entry_type($type);
         }
         if (!$multiple || $input->isset_var('use_priority', 'post')) {
             $entry->set_entry_priority($priority);
         }
         if (!$multiple || $input->get_var('change_lastchange_date', 'post', FWS_Input::INT_BOOL) == 1) {
             $entry->set_entry_changed_date($time);
         }
         if (!$entry->check('update')) {
             return $entry->errors();
         }
         $entry->update();
     }
     if ($multiple) {
         $msg = $locale->_('The entries have been edited successfully');
     } else {
         $msg = $locale->_('The entry has been edited successfully');
     }
     $this->set_success_msg($msg);
     $this->set_redirect(true, TDL_URL::get_entry_url());
     $this->set_action_performed(true);
     return '';
 }
示例#15
0
 /**
  * Deletes all given error-types for given project
  * 
  * @param array $types an array of the types
  * @param int $pid the project-id (default = current)
  * @return int the number of affected rows
  */
 public function delete_by_type($types, $pid = PC_Project::CURRENT_ID)
 {
     $db = FWS_Props::get()->db();
     if (!FWS_Array_Utils::is_integer($types) || count($types) == 0) {
         FWS_Helper::def_error('intarray>0', 'types', $types);
     }
     $stmt = $db->get_prepared_statement('DELETE FROM ' . PC_TB_ERRORS . ' WHERE project_id = :id AND type IN (:types)');
     $stmt->bind(':id', PC_Utils::get_project_id($pid));
     $stmt->bind(':types', $types);
     $db->execute($stmt->get_statement());
     return $db->get_affected_rows();
 }
示例#16
0
 /**
  * Builds an instance of PC_Obj_Class from the given row
  *
  * @param array $row the row from the db
  * @param int $pid the project-id
  * @param bool $lazy whether to load it lazy
  * @return PC_Obj_Class the class
  */
 private function build_class($row, $pid, $lazy = true)
 {
     $c = new PC_Obj_Class($row['file'], $row['line'], $row['id'], $pid, $lazy);
     $c->set_name($row['name']);
     $c->set_super_class($row['superclass']);
     $c->set_abstract($row['abstract']);
     $c->set_interface($row['interface']);
     $c->set_final($row['final']);
     $c->get_version()->set(unserialize($row['min_version']), unserialize($row['max_version']));
     foreach (FWS_Array_Utils::advanced_explode(',', $row['interfaces']) as $if) {
         $c->add_interface($if);
     }
     return $c;
 }