예제 #1
0
 /**
  * @see FWS_Module::init($doc)
  * 
  * @param TDL_Document $doc
  */
 public function init($doc)
 {
     parent::init($doc);
     $input = FWS_Props::get()->input();
     $functions = FWS_Props::get()->functions();
     $renderer = $doc->use_default_renderer();
     $locale = FWS_Props::get()->locale();
     $cfg = FWS_Props::get()->cfg();
     $renderer->add_action(TDL_ACTION_EDIT_ENTRY, 'edit');
     $renderer->add_action(TDL_ACTION_NEW_ENTRY, 'add');
     $mode = $input->correct_var(TDL_URL_MODE, 'get', FWS_Input::STRING, array('add', 'edit'), 'add');
     if ($mode == 'edit') {
         $id = $input->get_predef(TDL_URL_IDS, 'get');
         $murl = TDL_URL::get_entry_url();
         $murl->set(TDL_URL_ACTION, 'edit_entry');
         $murl->set(TDL_URL_MODE, 'edit');
         $murl->set(TDL_URL_IDS, $id);
         if (FWS_String::substr_count($id, ',') > 1) {
             $title = $locale->_('Edit entries');
         } else {
             $title = $locale->_('Edit entry');
         }
     } else {
         $murl = TDL_URL::get_mod_url();
         $murl->set(TDL_URL_MODE, 'add');
         $title = $locale->_('New entry');
     }
     $renderer->set_has_access($mode == 'edit' || $cfg['project_id'] != 0);
     $renderer->add_breadcrumb($title, $murl->to_url());
 }
예제 #2
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);
     }
 }
 public function perform_action()
 {
     $input = FWS_Props::get()->input();
     $locale = FWS_Props::get()->locale();
     $project_name = $input->get_var('project_name', 'post', FWS_Input::STRING);
     $project_name_short = $input->get_var('project_name_short', '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);
     $project = new TDL_Objects_Project(TDL_TB_PROJECTS);
     $project->set_project_name($project_name);
     $project->set_project_name_short($project_name_short);
     $project->set_project_start($start);
     if (!$project->check('create')) {
         return $project->errors();
     }
     $project->create();
     $id = $project->get_id();
     $edit_url = TDL_URL::get_mod_url('edit_project')->set(TDL_URL_MODE, 'edit')->set(TDL_URL_ID, $id);
     $this->set_success_msg($locale->_('The project has been added'));
     $this->set_redirect(true, $edit_url);
     $this->add_link($locale->_('Edit the project'), $edit_url);
     $this->set_action_performed(true);
     return '';
 }
예제 #4
0
 /**
  * @see FWS_Module::init($doc)
  * 
  * @param TDL_Document $doc
  */
 public function init($doc)
 {
     parent::init($doc);
     $renderer = $doc->use_default_renderer();
     $locale = FWS_Props::get()->locale();
     $renderer->add_action(TDL_ACTION_DELETE_PROJECTS, 'delete');
     $renderer->add_breadcrumb($locale->_('Projects'), TDL_URL::get_mod_url()->to_url());
 }
예제 #5
0
 /**
  * @see FWS_Module::init($doc)
  * 
  * @param TDL_Document $doc
  */
 public function init($doc)
 {
     parent::init($doc);
     $input = FWS_Props::get()->input();
     $renderer = $doc->use_default_renderer();
     $id = $input->get_predef(TDL_URL_ID, 'get');
     $renderer->add_breadcrumb('Eintrags Details', TDL_URL::get_mod_url()->set(TDL_URL_ID, $id)->to_url());
 }
예제 #6
0
 /**
  * @see FWS_Module::init($doc)
  * 
  * @param TDL_Document $doc
  */
 public function init($doc)
 {
     parent::init($doc);
     $input = FWS_Props::get()->input();
     $renderer = $doc->use_default_renderer();
     $locale = FWS_Props::get()->locale();
     $renderer->add_action(TDL_ACTION_CHANGE_STATUS, 'default');
     $id_str = $input->get_predef(TDL_URL_IDS, 'get');
     $renderer->add_breadcrumb($locale->_('Change state'), TDL_URL::get_mod_url()->set(TDL_URL_IDS, $id_str)->to_url());
 }
예제 #7
0
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->set_action_performer(new TDL_Actions_Performer());
     $tpl = FWS_Props::get()->tpl();
     $locale = FWS_Props::get()->locale();
     $tpl->set_path('theme/templates/');
     $tpl->set_cache_folder(FWS_Path::server_app() . 'cache/');
     // add the home-breadcrumb
     $this->add_breadcrumb($locale->_('TodoList'), TDL_URL::get_mod_url('view_entries')->to_url());
     $this->_action_perf->set_prefix('TDL_Action_');
     $a = new TDL_Actions_ChangeSelProject(TDL_ACTION_CHANGE_SEL_PROJECT);
     $this->_action_perf->add_action($a);
 }
 public function perform_action()
 {
     $input = FWS_Props::get()->input();
     $db = FWS_Props::get()->db();
     $cats = FWS_Props::get()->cats();
     $versions = FWS_Props::get()->versions();
     $locale = FWS_Props::get()->locale();
     $pid = $input->get_predef(TDL_URL_ID, 'get');
     if ($pid == null) {
         return TDL_GENERAL_ERROR;
     }
     $project_name = $input->get_var('project_name', 'post', FWS_Input::STRING);
     $project_name_short = $input->get_var('project_name_short', '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);
     $project = new TDL_Objects_Project(TDL_TB_PROJECTS);
     $project->set_id($pid);
     $project->set_project_name($project_name);
     $project->set_project_name_short($project_name_short);
     $project->set_project_start($start);
     if (!$project->check('update')) {
         return $project->errors();
     }
     $project->update();
     $nversions = $input->get_var('version', 'post');
     if (is_array($nversions)) {
         foreach ($nversions as $id => $version_name) {
             $db->execute('UPDATE ' . TDL_TB_VERSIONS . " SET version_name = '" . $version_name . "' WHERE id = " . $id);
             $versions->set_element_field($id, 'version_name', $version_name);
         }
     }
     $categories = $input->get_var('category', 'post');
     if (is_array($categories)) {
         foreach ($categories as $id => $category_name) {
             $db->execute('UPDATE ' . TDL_TB_CATEGORIES . " SET category_name = '" . $category_name . "' WHERE id = " . $id);
             $cats->set_element_field($id, 'category_name', $category_name);
         }
     }
     $this->set_success_msg($locale->_('The project has been edited successfully'));
     $this->set_redirect(true, TDL_URL::get_mod_url('edit_project')->set(TDL_URL_MODE, 'edit')->set(TDL_URL_ID, $pid));
     $this->set_show_status_page(false);
     $this->set_action_performed(true);
     return '';
 }
 public function perform_action()
 {
     $input = FWS_Props::get()->input();
     $db = FWS_Props::get()->db();
     $cats = FWS_Props::get()->cats();
     $locale = FWS_Props::get()->locale();
     $id = $input->get_predef(TDL_URL_SID, 'get');
     if ($id == null) {
         return TDL_GENERAL_ERROR;
     }
     $db->execute('DELETE FROM ' . TDL_TB_CATEGORIES . ' WHERE id = ' . $id);
     $db->execute('UPDATE ' . TDL_TB_ENTRIES . ' SET entry_category = 0 WHERE entry_category = ' . $id);
     $cats->remove_element($id);
     $pid = $input->get_predef(TDL_URL_ID, 'get');
     $this->set_success_msg($locale->_('The category has been deleted'));
     $this->set_redirect(true, TDL_URL::get_mod_url('edit_project')->set(TDL_URL_MODE, 'edit')->set(TDL_URL_ID, $pid));
     $this->set_show_status_page(false);
     $this->set_action_performed(true);
     return '';
 }
    public function perform_action()
    {
        $input = FWS_Props::get()->input();
        $db = FWS_Props::get()->db();
        $versions = FWS_Props::get()->versions();
        $locale = FWS_Props::get()->locale();
        $pid = $input->get_predef(TDL_URL_ID, 'get');
        if ($pid == null) {
            return TDL_GENERAL_ERROR;
        }
        $db->execute('INSERT INTO ' . TDL_TB_VERSIONS . ' (version_name,project_id)
			 VALUES (\'\',' . $pid . ')');
        $id = $db->get_inserted_id();
        $versions->add_element(array('id' => $id, 'version_name' => '', 'project_id' => $pid), $id);
        $this->set_success_msg($locale->_('The version has been added'));
        $this->set_redirect(true, TDL_URL::get_mod_url('edit_project')->set(TDL_URL_MODE, 'edit')->set(TDL_URL_ID, $pid));
        $this->set_show_status_page(false);
        $this->set_action_performed(true);
        return '';
    }
예제 #11
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;
     }
     // 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 '';
 }
예제 #12
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 '';
 }
예제 #13
0
 /**
  * @see FWS_Module::run()
  */
 public function run()
 {
     $input = FWS_Props::get()->input();
     $db = FWS_Props::get()->db();
     $cats = FWS_Props::get()->cats();
     $tpl = FWS_Props::get()->tpl();
     $versions = FWS_Props::get()->versions();
     $functions = FWS_Props::get()->functions();
     $mode = $input->correct_var(TDL_URL_MODE, 'get', FWS_Input::STRING, array('add', 'edit'), 'add');
     if ($mode == 'edit') {
         $id = $input->get_predef(TDL_URL_ID, 'get');
         if ($id === null) {
             $this->report_error();
             return;
         }
         $data = $db->get_row('SELECT * FROM ' . TDL_TB_PROJECTS . ' WHERE id = ' . $id);
         if ($data['id'] == '') {
             $this->report_error();
             return;
         }
         $target_url = TDL_URL::get_mod_url();
         $target_url->set(TDL_URL_MODE, 'edit');
         $target_url->set(TDL_URL_ID, $id);
         $action_type = TDL_ACTION_EDIT_PROJECT;
     } else {
         $data = array('project_name' => '', 'project_name_short' => '', 'project_start' => 0);
         $target_url = TDL_URL::get_mod_url();
         $target_url->set(TDL_URL_MODE, 'add');
         $action_type = TDL_ACTION_ADD_PROJECT;
     }
     $this->request_formular();
     $tplversions = '';
     $rows = $mode == 'edit' ? $versions->get_elements_with(array('project_id' => $id)) : array();
     usort($rows, array($functions, 'sort_versions_by_name_callback'));
     if (count($rows) == 0) {
         $tplversions = ' - ';
     } else {
         foreach ($rows as $row) {
             $tplversions .= $this->_get_input_delete_field($target_url, $row['id'], 'version', $row['version_name'], TDL_ACTION_DELETE_VERSION);
         }
     }
     $categories = '';
     $rows = $mode == 'edit' ? $cats->get_elements_with(array('project_id' => $id)) : array();
     if (count($rows) == 0) {
         $categories = ' - ';
     } else {
         foreach ($rows as $row) {
             $categories .= $this->_get_input_delete_field($target_url, $row['id'], 'category', $row['category_name'], TDL_ACTION_DELETE_CATEGORY);
         }
     }
     $tpl->add_variables(array('mode' => $mode, 'target_url' => $target_url->to_url(), 'action_type' => $action_type, 'def_name' => $data['project_name'], 'def_name_short' => $data['project_name_short'], 'def_start' => $data['project_start'], 'versions' => $tplversions, 'categories' => $categories, 'add_version_url' => $target_url->set(TDL_URL_AT, TDL_ACTION_ADD_VERSION)->to_url(), 'add_category_url' => $target_url->set(TDL_URL_AT, TDL_ACTION_ADD_CATEGORY)->to_url()));
 }