/** * list a members own projects */ function __listProjects() { /* --------------URI SEGMENTS--------------- * [example] * /client/projects/list/in-progress/0 * (2)->controller * (3)->router * (4)->status (open/closed) * (5)->offset ** -----------------------------------------*/ //profiling $this->data['controller_profiling'][] = __FUNCTION__; //uri segments $status = $this->uri->segment(4); $offset = is_numeric($this->uri->segment(5)) ? $this->uri->segment(5) : 0; //additional data $members_id = $this->data['vars']['my_id']; //get results and save for tbs block merging $this->data['reg_blocks'][] = 'projects'; $this->data['blocks']['projects'] = $this->projects_model->searchProjects($offset, 'search', $this->client_id, $status); $this->data['debug'][] = $this->projects_model->debug_data; //count results rows - used by pagination class $rows_count = $this->projects_model->searchProjects($offset, 'count', $this->client_id, $status); $this->data['debug'][] = $this->projects_model->debug_data; //pagination $config = pagination_default_config(); // $config['base_url'] = site_url("/client/projects/list/{$status}"); $config['total_rows'] = $rows_count; $config['per_page'] = $this->data['settings_general']['results_limit']; $config['uri_segment'] = 5; //the offset var $this->pagination->initialize($config); $this->data['vars']['pagination'] = $this->pagination->create_links(); //visibility if ($rows_count > 0) { //show side menu $this->data['visible']['wi_projects_table'] = 1; } else { //show mothing found $this->notifications('wi_notification', $this->data['lang']['lang_no_results_found']); } //append to main title switch ($status) { case 'in-progress': $this->data['vars']['main_title'] .= ' - ' . $this->data['lang']['lang_in_progress']; break; case 'closed': $this->data['vars']['main_title'] .= ' - ' . $this->data['lang']['lang_closed']; break; case 'behind-schedule': $this->data['vars']['main_title'] .= ' - ' . $this->data['lang']['lang_behind_schedule']; break; } }
/** * list all tickets by default or results of search. if no search data is posted, list all tickets * */ function __listTickets() { /* --------------URI SEGMENTS--------------- * [example] * /admin/tickets/list/new/54/desc/sortby_ticketid/0 * (2)->controller * (3)->router * (4)->status * (5)->search id * (6)->sort_by * (7)->sort_by_column * (8)->offset ** -----------------------------------------*/ //profiling $this->data['controller_profiling'][] = __FUNCTION__; //any session notices //table title $this->data['vars']['ticket_table_title'] = $this->uri->segment(4); //uri segments $status = $this->uri->segment(4); $search_id = is_numeric($this->uri->segment(5)) ? $this->uri->segment(5) : 0; $sort_by = $this->uri->segment(6) == 'desc' ? 'desc' : 'asc'; $sort_by_column = $this->uri->segment(7) == '' ? 'sortby_ticketid' : $this->uri->segment(7); $offset = is_numeric($this->uri->segment(8)) ? $this->uri->segment(8) : 0; //load the original posted search into $_get array $this->input->load_query($search_id); //get results and save for tbs block merging $this->data['reg_blocks'][] = 'tickets'; $this->data['blocks']['tickets'] = $this->tickets_model->searchTickets($offset, 'search'); $this->data['debug'][] = $this->tickets_model->debug_data; //count results rows - used by pagination class $rows_count = $this->tickets_model->searchTickets($offset, 'count'); $this->data['debug'][] = $this->tickets_model->debug_data; //pagination $config = pagination_default_config(); //load all other settings from helper $config['base_url'] = site_url("admin/tickets/list/{$status}/{$search_id}/{$sort_by}/{$sort_by_column}"); $config['total_rows'] = $rows_count; $config['per_page'] = $this->data['settings_general']['results_limit']; $config['uri_segment'] = 8; //the offset var $this->pagination->initialize($config); $this->data['vars']['pagination'] = $this->pagination->create_links(); //sorting links for menus on the top of the table //the array names mustbe same as used in clients_model.php->searchClients() $link_sort_by = $sort_by == 'asc' ? 'desc' : 'asc'; //flip the sort_by $link_sort_by_column = array('sortby_ticketid', 'sortby_datecreated', 'sortby_dateactive', 'sortby_status'); foreach ($link_sort_by_column as $column) { $this->data['vars'][$column] = site_url("admin/tickets/list/{$status}/{$search_id}/{$link_sort_by}/{$column}/{$offset}"); } //visibility - show table or show nothing found if ($rows_count > 0 && !empty($this->data['blocks']['tickets'])) { //final processing of data $this->data['blocks']['tickets'] = dataprep_tickets_list($this->data['blocks']['tickets']); //show table $this->data['visible']['wi_tickets_table'] = 1; } else { //show no results $this->notifications('wi_notification', $this->data['lang']['lang_no_results_found']); } }
/** * main-handler function * manage all project milestones * */ function __milestonesView() { //profiling $this->data['controller_profiling'][] = __FUNCTION__; //flow control $next = true; /** refresh the milestones tables **/ $this->refresh->milestones($this->project_id); $this->data['debug'][] = $this->refresh->debug_data; //library debug //display mile stone if ($this->milestones_model->countMilestones($this->project_id, 'all') <= 0) { //set notice visible $this->notifications('wi_tabs_notification', $this->data['lang']['lang_no_milestones_for_this_project']); //show some information/tips $this->data['vars']['milestone_info_no_milestones_found'] = 1; //set counters $this->data['rows1'] = array('in_progress' => 0, 'completed' => 0, 'behind_schedule' => 0); //stop $next = false; } $this->data['debug'][] = $this->milestones_model->debug_data; //get some milestone stats if ($next) { //in progress $this->data['rows1']['in_progress'] = $this->milestones_model->countMilestones($this->project_id, 'in progress'); $this->data['debug'][] = $this->milestones_model->debug_data; //behind schedule $this->data['rows1']['behind_schedule'] = $this->milestones_model->countMilestones($this->project_id, 'behind schedule'); $this->data['debug'][] = $this->milestones_model->debug_data; //completed $this->data['rows1']['completed'] = $this->milestones_model->countMilestones($this->project_id, 'completed'); $this->data['debug'][] = $this->milestones_model->debug_data; } //show list/search results if ($next) { //offset - used by sql to detrmine next starting point $offset = is_numeric($this->uri->segment(7)) ? $this->uri->segment(7) : 0; //get results and save for tbs block merging $this->data['reg_blocks'][] = 'milestones'; $this->data['blocks']['milestones'] = $this->milestones_model->listMilestones($offset, 'search', $this->project_id); $this->data['debug'][] = $this->milestones_model->debug_data; //count results rows - used by pagination class $rows_count = $this->milestones_model->listMilestones($offset, 'count', $this->project_id); $this->data['debug'][] = $this->milestones_model->debug_data; //sorting pagination data that is added to pagination links $sort_by = $this->uri->segment(8) == 'desc' ? 'desc' : 'asc'; $sort_by_column = $this->uri->segment(7) == '' ? 'sortby_id' : $this->uri->segment(7); //http://mydomain.com/admin/project/2/milestones/view/all/sortby_pending/asc //pagination $config = pagination_default_config(); //load all other settings from helper $config['base_url'] = site_url("admin/project/" . $this->project_id . "/milestones/view/" . $this->uri->segment(6) . "/{$sort_by}/{$sort_by_column}"); $config['total_rows'] = $rows_count; $config['per_page'] = $this->data['settings_general']['results_limit']; $config['uri_segment'] = 9; //the offset var $this->pagination->initialize($config); $this->data['vars']['pagination'] = $this->pagination->create_links(); //sorting links for menus on the top of the table //the array names mustbe same as used in clients_model.php->searchClients() $link_sort_by = $sort_by == 'asc' ? 'desc' : 'asc'; //flip the sort_by $link_sort_by_column = array('sortby_id', 'sortby_status', 'sortby_title', 'sortby_start_date', 'sortby_end_date'); foreach ($link_sort_by_column as $column) { $this->data['vars'][$column] = site_url("admin/project/" . $this->project_id . "/milestones/view/" . $this->uri->segment(6) . "/{$link_sort_by}/{$column}/{$offset}"); } //visibility - show table or show nothing found if ($rows_count > 0) { //show table $this->data['visible']['wi_milestones_table'] = 1; } else { //show nothing found $this->notifications('wi_tabs_notification', $this->data['lang']['lang_no_results_found']); } /** SEND DATA FOR ADDITIONAL PREPARATION **/ $this->data['blocks']['milestones'] = $this->__prepMilestonesView($this->data['blocks']['milestones']); } }
/** * list all clients by default or results of client search. if no search data is posted, list all clients * */ function __listClients() { /* --------------URI SEGMENTS--------------- * [example] * /admin/clients/list/54/desc/sortby_dueinvoices/0 * (2)->controller * (3)->router * (4)->search id * (5)->sort_by * (6)->sort_by_column * (7)->offset ** -----------------------------------------*/ //PERMISSION CHECK if ($this->data['permission']['view_item_clients'] != 1) { redirect('/admin/error/permission-denied'); } //profiling $this->data['controller_profiling'][] = __FUNCTION__; //show wi_clients_search widget $this->data['visible']['wi_clients_search'] = 1; //retrieve any search cache query string $search_id = is_numeric($this->uri->segment(4)) ? $this->uri->segment(4) : 0; //offset - used by sql to detrmine next starting point $offset = is_numeric($this->uri->segment(7)) ? $this->uri->segment(7) : 0; //load the original posted search into $_get array $this->input->load_query($search_id); //get results and save for tbs block merging $this->data['blk1'] = $this->clients_model->searchClients($offset, 'search'); $this->data['debug'][] = $this->clients_model->debug_data; //count results rows - used by pagination class $rows_count = $this->clients_model->searchClients($offset, 'count'); $this->data['debug'][] = $this->clients_model->debug_data; //sorting pagination data that is added to pagination links $sort_by = $this->uri->segment(5) == 'desc' ? 'desc' : 'asc'; $sort_by_column = $this->uri->segment(6) == '' ? 'sortby_clientid' : $this->uri->segment(6); //pagination $config = pagination_default_config(); //load all other settings from helper $config['base_url'] = site_url("admin/clients/list/{$search_id}/{$sort_by}/{$sort_by_column}"); $config['total_rows'] = $rows_count; $config['per_page'] = $this->data['settings_general']['results_limit']; $config['uri_segment'] = 7; //the offset var $this->pagination->initialize($config); $this->data['vars']['pagination'] = $this->pagination->create_links(); //sorting links for menus on the top of the table //the array names mustbe same as used in clients_model.php->searchClients() $link_sort_by = $sort_by == 'asc' ? 'desc' : 'asc'; //flip the sort_by $link_sort_by_column = array('sortby_clientid', 'sortby_contactname', 'sortby_dueinvoices', 'sortby_projects', 'sortby_allinvoices', 'sortby_companyname'); foreach ($link_sort_by_column as $column) { $this->data['vars'][$column] = site_url("admin/clients/list/{$search_id}/{$link_sort_by}/{$column}/{$offset}"); } //informational: show sorting criteria in footer of table $this->data['vars']['info_sort_by'] = $sort_by; $this->data['vars']['info_sort_by_column'] = $sort_by_column; $this->data['vars']['showing_x_results'] = $this->data['settings_general']['results_limit']; $this->data['vars']['results_count'] = $rows_count; //Optional Form Fields [client table] //used by various modal like "add new client" $this->__optionalFormFieldsDisplay(); //visibility - show table or show nothing found if ($rows_count > 0 && !empty($this->data['blk1'])) { $this->data['visible']['wi_clients_table'] = 1; } else { $this->notifications('wi_notification', $this->data['lang']['lang_no_results_found']); } }
/** * load timers */ function __timersView($view = 'all') { /* --------------URI SEGMENTS--------------- * [example] * /admin/timers/view/all/54/asc/sortby_id/2 * (2)->controller * (3)->router * (4)->view-type * (5)->search id * (6)->sort_order * (7)->sort_by_column * (8)->offset ** -----------------------------------------*/ //profiling $this->data['controller_profiling'][] = __FUNCTION__; //uri segments $view_type = $this->uri->segment(4); $search_id = is_numeric($this->uri->segment(5)) ? $this->uri->segment(5) : 0; $sort_by = $this->uri->segment(6) == 'desc' ? 'desc' : 'asc'; $sort_by_column = $this->uri->segment(7) == '' ? 'sortby_time' : $this->uri->segment(7); $offset = is_numeric($this->uri->segment(8)) ? $this->uri->segment(8) : 0; //load the original posted search into $_get array $this->input->load_query($search_id); //get results and save for tbs block merging $this->data['reg_blocks'][] = 'timers'; $this->data['blocks']['timers'] = $this->timer_model->viewTimers($offset, 'search', $view_type); $this->data['debug'][] = $this->timer_model->debug_data; //count results rows - used by pagination class $rows_count = $this->timer_model->viewTimers($offset, 'count', $view_type); $this->data['debug'][] = $this->timer_model->debug_data; $this->data['vars']['count_timers'] = $rows_count; //pagination $config = pagination_default_config(); // $config['base_url'] = site_url("admin/timers/view/{$view_type}/{$search_id}/{$sort_by}/{$sort_by_column}"); $config['total_rows'] = $rows_count; $config['per_page'] = $this->data['settings_general']['results_limit']; $config['uri_segment'] = 8; //the offset var $this->pagination->initialize($config); $this->data['vars']['pagination'] = $this->pagination->create_links(); //sorting links for menus on the top of the table $link_sort_by = $sort_by == 'asc' ? 'desc' : 'asc'; //flip the sort_by $link_sort_by_column = array('sortby_time', 'sortby_project', 'sortby_assigned_to'); foreach ($link_sort_by_column as $column) { $this->data['vars'][$column] = site_url("admin/timers/view/{$view_type}/{$search_id}/{$link_sort_by}/{$column}/{$offset}"); } //visibility if ($rows_count > 0) { //show side menu $this->data['visible']['wi_timers_table'] = 1; } else { //show mothing found $this->notifications('wi_notification', $this->data['lang']['lang_no_results_found']); } //set hidden value of current url (used for redirect on timer edits) $this->data['vars']['current_url'] = current_url(); //final data preps $this->data['blocks']['timers'] = $this->__prepTimers($this->data['blocks']['timers']); }
/** * main-handler function * manage all project tasks * */ function __tasksView() { /* --------------URI SEGMENTS--------------- * [example] * /admin/tasks/2/view/0/desc/sortby_end_date/all/0 * (2)->controller * (3)->project_id * (4)->router * (5)->milestone_id * (6)->sort_by * (7)->sort_by_column * (8)->all or my * (9)->status (all/pending/behind-schedule/completed/all-open) * (10)->offset * -----------------------------------------*/ //profiling $this->data['controller_profiling'][] = __FUNCTION__; //refresh task status (all tasks) $this->refresh->taskStatus('all'); //uri segments $project_id = $this->uri->segment(3); $milestone_id = $this->uri->segment(5) > 0 ? $this->uri->segment(5) : 0; $sort_by = $this->uri->segment(6) == 'desc' ? 'desc' : 'asc'; $sort_by_column = $this->uri->segment(7) == '' ? 'sortby_taskid' : $this->uri->segment(7); $status = $this->uri->segment(9) == '' ? 'all-open' : $this->uri->segment(9); $offset = is_numeric($this->uri->segment(10)) ? $this->uri->segment(10) : 0; //are we listing ALL tasks or just MY tasks $show_which = $this->uri->segment(8) == 'my' ? $this->uri->segment(8) : 'all'; //toggle [view my tasks] OR [view all tasks] buttons if ($show_which == 'all') { $this->data['visible']['button_show_my_tasks'] = 1; } else { $this->data['visible']['button_show_all_tasks'] = 1; } //css side menu highlight $active_milestone = "css_menu_tasks_side_{$milestone_id}"; $this->data['vars'][$active_milestone] = 'side-menu-active'; //load all milestones and their task count for side menu $this->data['reg_blocks'][] = 'tasks_milestones'; $this->data['blocks']['tasks_milestones'] = $this->milestones_model->listMilestones(0, 'results', $this->project_id); $this->data['debug'][] = $this->milestones_model->debug_data; //get results and save for tbs block merging $this->data['reg_blocks'][] = 'tasks'; $this->data['blocks']['tasks'] = $this->tasks_model->listTasks($offset, 'search', $this->project_id, $status); $this->data['debug'][] = $this->tasks_model->debug_data; //count results rows - used by pagination class $rows_count = $this->tasks_model->listTasks($offset, 'count', $this->project_id, $status); $this->data['debug'][] = $this->tasks_model->debug_data; //pagination $config = pagination_default_config(); // $config['base_url'] = site_url("admin/tasks/{$project_id}/view/{$milestone_id}/{$sort_by}/{$sort_by_column}/{$show_which}/{$status}/"); $config['total_rows'] = $rows_count; $config['per_page'] = $this->data['settings_general']['results_limit']; $config['uri_segment'] = 10; //the offset var $this->pagination->initialize($config); $this->data['vars']['pagination'] = $this->pagination->create_links(); //sorting links for menus on the top of the table $link_sort_by = $sort_by == 'asc' ? 'desc' : 'asc'; //flip the sort_by $link_sort_by_column = array('sortby_id', 'sortby_status', 'sortby_end_date'); foreach ($link_sort_by_column as $column) { $this->data['vars'][$column] = site_url("admin/tasks/{$project_id}/view/{$milestone_id}/{$link_sort_by}/{$column}/{$show_which}/{$status}/{$offset}"); } //status buttons links $this->data['vars']['completed_tasks_link'] = site_url("admin/tasks/{$project_id}/view/{$milestone_id}/{$link_sort_by}/{$column}/{$show_which}/completed/{$offset}"); $this->data['vars']['pending_tasks_link'] = site_url("admin/tasks/{$project_id}/view/{$milestone_id}/{$link_sort_by}/{$column}/{$show_which}/pending/{$offset}"); $this->data['vars']['behind_tasks_link'] = site_url("admin/tasks/{$project_id}/view/{$milestone_id}/{$link_sort_by}/{$column}/{$show_which}/behind-schedule/{$offset}"); $this->data['vars']['all_tasks_link'] = site_url("admin/tasks/{$project_id}/view/{$milestone_id}/{$link_sort_by}/{$column}/{$show_which}/all/{$offset}"); //Tasks page title if ($this->uri->segment(8) == 'my') { $whose = $this->data['lang']['lang_my_tasks']; } else { $whose = $this->data['lang']['lang_all_tasks']; } if ($results = $this->milestones_model->milestoneDetails($milestone_id)) { $this->data['vars']['tasks_tabs_title'] = $whose . ' - (' . $results['milestones_title'] . ')'; } else { $this->data['vars']['tasks_tabs_title'] = $whose . ' - (' . $this->data['lang']['lang_all_milestones'] . ')'; } $this->data['debug'][] = $this->tasks_model->debug_data; //various tasks counts (for side menu etc) $this->data['vars']['count_tasks_pending'] = $this->tasks_model->countTasks($this->project_id, 'project', 'pending', $show_which); $this->data['debug'][] = $this->tasks_model->debug_data; $this->data['vars']['count_tasks_completed'] = $this->tasks_model->countTasks($this->project_id, 'project', 'completed', $show_which); $this->data['debug'][] = $this->tasks_model->debug_data; $this->data['vars']['count_tasks_behind_schedule'] = $this->tasks_model->countTasks($this->project_id, 'project', 'behind schedule', $show_which); $this->data['debug'][] = $this->tasks_model->debug_data; //visibility if ($rows_count > 0) { //show side menu $this->data['visible']['tasks_milestone_list'] = 1; } else { //show mothing found $this->notifications('wi_tabs_notification', $this->data['lang']['lang_no_results_found']); //show some information/tips $this->data['vars']['tasks_info_no_tasks_found'] = 1; } /** SEND DATA FOR ADDITIONAL PREPARATION **/ $this->data['blocks']['tasks'] = $this->__prepTasksView($this->data['blocks']['tasks']); //flow control $next = true; }
/** * load all of a clients users */ function __clientUsers() { /* --------------URI SEGMENTS--------------- * [example] * client/users/view/asc/sortby_id/2 * (2)->controller * (3)->router * (4)->sort_order * (5)->sort_by_column * (6)->offset ** -----------------------------------------*/ //profiling $this->data['controller_profiling'][] = __FUNCTION__; //uri segments $sort_by = $this->uri->segment(4) == 'desc' ? 'desc' : 'asc'; $sort_by_column = $this->uri->segment(5) == '' ? 'sortby_due_date' : $this->uri->segment(5); $offset = is_numeric($this->uri->segment(6)) ? $this->uri->segment(6) : 0; //get results and save for tbs block merging $this->data['reg_blocks'][] = 'client_users'; $this->data['blocks']['client_users'] = $this->users_model->searchUsers($offset, 'search', $this->client_id); $this->data['debug'][] = $this->users_model->debug_data; //count results rows - used by pagination class $rows_count = $this->users_model->searchUsers($offset, 'count', $this->client_id); $this->data['debug'][] = $this->users_model->debug_data; //pagination $config = pagination_default_config(); $config['base_url'] = site_url("client/users/view/{$sort_by}/{$sort_by_column}"); $config['total_rows'] = $rows_count; $config['per_page'] = $this->data['settings_general']['results_limit']; $config['uri_segment'] = 6; //the offset var $this->pagination->initialize($config); $this->data['vars']['pagination'] = $this->pagination->create_links(); //sorting links for menus on the top of the table $link_sort_by = $sort_by == 'asc' ? 'desc' : 'asc'; //flip the sort_by $link_sort_by_column = array('sortby_fullname'); foreach ($link_sort_by_column as $column) { $this->data['vars'][$column] = site_url("client/users/view/{$link_sort_by}/{$column}/{$offset}"); } //visibility if ($rows_count > 0) { //show side menu $this->data['visible']['wi_client_users'] = 1; } else { //show mothing found $this->notifications('wi_tabs_notification', $this->data['lang']['lang_no_users_found']); } }
/** * view project messages */ function __messagesView() { /* --------------URI SEGMENTS--------------- * [example] * /client/messages/2/view/1 * (2)->controller * (3)->project id * (4)->route * (5)->offset ** -----------------------------------------*/ //profiling $this->data['controller_profiling'][] = __FUNCTION__; //explicitly set messaged template file (needed) $this->data['template_file'] = PATHS_CLIENT_THEME . 'project.messages.html'; //uri segments $offset = is_numeric($this->uri->segment(5)) ? $this->uri->segment(5) : 0; //correct offset for incoming method calls from __editMessages() and __editReplies() if ($this->uri->segment(4) == 'edit-message' || $this->uri->segment(4) == 'edit-reply') { $offset = is_numeric($this->uri->segment(6)) ? $this->uri->segment(6) : 0; } //set offset for use in template $this->data['vars']['offset'] = $offset; //get results and save for tbs block merging $this->data['reg_blocks'][] = 'messages'; $this->data['blocks']['messages'] = $this->messages_model->listMessages($offset, 'search', $this->project_id); $this->data['debug'][] = $this->messages_model->debug_data; //count results rows - used by pagination class $rows_count = $this->messages_model->listMessages($offset, 'count', $this->project_id); $this->data['debug'][] = $this->messages_model->debug_data; //pagination $config = pagination_default_config(); // $config['base_url'] = site_url("client/messages/" . $this->project_id . "/view"); $config['total_rows'] = $rows_count; $config['per_page'] = $this->data['settings_general']['messages_limit']; $config['uri_segment'] = 5; //the offset var $this->pagination->initialize($config); $this->data['vars']['pagination'] = $this->pagination->create_links(); //visibility if ($rows_count > 0) { //show side menu $this->data['visible']['wi_project_messages'] = 1; } else { //show mothing found $this->notifications('wi_tabs_notification', $this->data['lang']['lang_no_results_found']); } //prepare data $this->data['blocks']['messages'] = $this->__prepMessagesView($this->data['blocks']['messages']); }
/** * list all users by default or results of client search. if no search data is posted, list all clients * */ function __listUsers() { //profiling $this->data['controller_profiling'][] = __FUNCTION__; //show wi_clients_search widget $this->data['visible']['wi_users_search'] = 1; //retrieve any search cache query string $search_id = is_numeric($this->uri->segment(4)) ? $this->uri->segment(4) : 0; //offset - used by sql to detrmine next starting point $offset = is_numeric($this->uri->segment(7)) ? $this->uri->segment(7) : 0; //load the original posted search into $_get array $this->input->load_query($search_id); //get results and save for tbs block merging $this->data['blk1'] = $this->users_model->searchUsers($offset, 'search'); $this->data['debug'][] = $this->users_model->debug_data; //count results rows - used by pagination class $rows_count = $this->users_model->searchUsers($offset, 'count'); $this->data['debug'][] = $this->users_model->debug_data; //sorting pagination data that is added to pagination links $sort_by = $this->uri->segment(5) == 'desc' ? 'desc' : 'asc'; $sort_by_column = $this->uri->segment(6) == '' ? 'sortby_userid' : $this->uri->segment(6); //pagination $config = pagination_default_config(); //load all other settings from helper $config['base_url'] = site_url("admin/users/list/{$search_id}/{$sort_by}/{$sort_by_column}"); $config['total_rows'] = $rows_count; $config['per_page'] = $this->data['settings_general']['results_limit']; $config['uri_segment'] = 7; //the offset var $this->pagination->initialize($config); $this->data['vars']['pagination'] = $this->pagination->create_links(); //sorting links for menus on the top of the table //the array names mustbe same as used in clients_model.php->searchClients() $link_sort_by = $sort_by == 'asc' ? 'desc' : 'asc'; //flip the sort_by $link_sort_by_column = array('sortby_userid', 'sortby_companyname', 'sortby_fullname'); foreach ($link_sort_by_column as $column) { $this->data['vars'][$column] = site_url("admin/users/list/{$search_id}/{$link_sort_by}/{$column}/{$offset}"); } //informational: show sorting criteria in footer of table $this->data['vars']['info_sort_by'] = $sort_by; $this->data['vars']['info_sort_by_column'] = $sort_by_column; $this->data['vars']['showing_x_results'] = $this->data['settings_general']['results_limit']; $this->data['vars']['results_count'] = $rows_count; //visibility - show table or show nothing found if ($rows_count > 0 && !empty($this->data['blk1'])) { $this->data['visible']['wi_users_table'] = 1; } else { $this->notifications('wi_notification', $this->data['lang']['lang_no_results_found']); } }
/** * list/search for all payments */ function __viewPayments() { /* --------------URI SEGMENTS--------------- * [example] * /client/payments/view/54/desc/sortby_id/0 * (2)->controller * (3)->router * (4)->search id * (5)->sort_by * (6)->sort_by_column * (7)->offset ** -----------------------------------------*/ //profiling $this->data['controller_profiling'][] = __FUNCTION__; //uri segments $search_id = is_numeric($this->uri->segment(4)) ? $this->uri->segment(4) : 0; $sort_by = $this->uri->segment(5) == 'desc' ? 'desc' : 'asc'; $sort_by_column = $this->uri->segment(6) == '' ? 'sortby_id' : $this->uri->segment(6); $offset = is_numeric($this->uri->segment(7)) ? $this->uri->segment(7) : 0; //load the original posted search into $_get array $this->input->load_query($search_id); //get results and save for tbs block merging $this->data['reg_blocks'][] = 'all_payments'; $this->data['blocks']['all_payments'] = $this->payments_model->searchPayments($offset, 'search', '', 'all'); $this->data['debug'][] = $this->payments_model->debug_data; //count results rows - used by pagination class $rows_count = $this->payments_model->searchPayments($offset, 'count', '', 'all'); $this->data['vars']['all_payments_count'] = $rows_count; $this->data['debug'][] = $this->payments_model->debug_data; //pagination $config = pagination_default_config(); $config['base_url'] = site_url("client/payments/view/{$search_id}/{$sort_by}/{$sort_by_column}"); $config['total_rows'] = $rows_count; $config['per_page'] = $this->data['settings_general']['results_limit']; $config['uri_segment'] = 7; //the offset var $this->pagination->initialize($config); $this->data['vars']['pagination'] = $this->pagination->create_links(); //sorting links for menus on the top of the table //the array names mustbe same as used in payments_model $link_sort_by = $sort_by == 'asc' ? 'desc' : 'asc'; //flip the sort_by $link_sort_by_column = array('sortby_id', 'sortby_date', 'sortby_amount', 'sortby_method', 'sortby_project', 'sortby_invoice', 'sortby_client'); foreach ($link_sort_by_column as $column) { $this->data['vars'][$column] = site_url("client/payments/view/{$search_id}/{$link_sort_by}/{$column}/{$offset}"); } //visibility - show table or show nothing found if ($rows_count > 0 && !empty($this->data['blocks']['all_payments'])) { $this->data['visible']['wi_payments_table'] = 1; } else { $this->notifications('wi_notification', $this->data['lang']['lang_no_results_found']); } }
/** * example of a paginated method with no cached search */ function __filesView() { /* --------------URI SEGMENTS--------------- * [example] * /admin/files/2/view/54/asc/sortby_fileid/20 * (2)->controller * (3)->project id * (4)->router * (5)->search id * (6)->sort_by * (7)->sort_by_column * (8)->offset ** -----------------------------------------*/ //profiling $this->data['controller_profiling'][] = __FUNCTION__; //flow control $next = true; //uri segments $search_id = $sort_by = $this->uri->segment(6) == 'desc' ? 'desc' : 'asc'; $sort_by_column = $this->uri->segment(7) == '' ? 'sortby_fileid' : $this->uri->segment(7); $offset = is_numeric($this->uri->segment(8)) ? $this->uri->segment(8) : 0; $search_id = is_numeric($this->uri->segment(5)) ? $this->uri->segment(5) : 0; //get results and save for tbs block merging $this->data['reg_blocks'][] = 'files'; $this->data['blocks']['files'] = $this->files_model->searchFiles($offset, 'search', $this->project_id); $this->data['debug'][] = $this->files_model->debug_data; //count results rows - used by pagination class $rows_count = $this->files_model->searchFiles($offset, 'count', $this->project_id); $this->data['debug'][] = $this->files_model->debug_data; //pagination $config = pagination_default_config(); $config['base_url'] = site_url("admin/files/" . $this->project_id . "/view/{$search_id}/{$sort_by}/{$sort_by_column}"); $config['total_rows'] = $rows_count; $config['per_page'] = $this->data['settings_general']['results_limit']; $config['uri_segment'] = 8; //the offset var $this->pagination->initialize($config); $this->data['vars']['pagination'] = $this->pagination->create_links(); //sorting links for menus on the top of the table $link_sort_by = $sort_by == 'asc' ? 'desc' : 'asc'; //flip the sort_by $link_sort_by_column = array('sortby_fileid', 'sortby_filename', 'sortby_milestone', 'sortby_projectid', 'sortby_downloads', 'sortby_filetype', 'sortby_uploadedby', 'sortby_date', 'sortby_size'); foreach ($link_sort_by_column as $column) { $this->data['vars'][$column] = site_url("admin/files/" . $this->project_id . "/view/{$search_id}/{$link_sort_by}/{$column}/{$offset}"); } //visibility if ($rows_count > 0) { //show results $this->data['visible']['wi_files_table'] = 1; } else { //show mothing found $this->notifications('wi_tabs_notification', $this->data['lang']['lang_no_files_for_this_project']); } /** SEND DATA FOR ADDITIONAL PREPARATION **/ $this->data['blocks']['files'] = $this->__prepFilesView($this->data['blocks']['files']); }
/** * list/search for invoice items */ function __viewInvoices() { /* --------------URI SEGMENTS--------------- * [example] * /admin/invoices/2/view/all/0 * (2)->controller * (3)-> project id * (4)->router * (5)->type [all/paid/pending/overdue] * (6)-> offset ** -----------------------------------------*/ //profiling $this->data['controller_profiling'][] = __FUNCTION__; //flow control $next = true; //uri segments $offset = is_numeric($this->uri->segment(6)) ? $this->uri->segment(6) : 0; $status = $this->uri->segment(5); //validate status param $valid_status = array('new', 'due', 'paid', 'overdue', 'all'); if (in_array($status, $valid_status)) { $invoice_status = $status; } else { $invoice_status = 'all'; } //get results and save for tbs block merging $this->data['reg_blocks'][] = 'invoices'; $this->data['blocks']['invoices'] = $this->invoices_model->viewInvoices($offset, 'search', $this->project_id, $invoice_status); $this->data['debug'][] = $this->invoices_model->debug_data; //count results rows - used by pagination class $rows_count = $this->invoices_model->viewInvoices($offset, 'count', $this->project_id, $invoice_status); $this->data['vars']['invoice_items_count'] = $rows_count; $this->data['debug'][] = $this->invoices_model->debug_data; //pagination $config = pagination_default_config(); $config['base_url'] = site_url("admin/invoices/" . $this->project_id . "/view/{$invoice_status}"); $config['total_rows'] = $rows_count; $config['per_page'] = $this->data['settings_general']['results_limit']; $config['uri_segment'] = 6; //the offset var $this->pagination->initialize($config); $this->data['vars']['pagination'] = $this->pagination->create_links(); //various counts for the side menu $this->data['vars']['count_invoices_all'] = $this->invoices_model->countInvoices($this->project_id, 'project', 'all'); $this->data['debug'][] = $this->invoices_model->debug_data; $this->data['vars']['count_invoices_open'] = $this->invoices_model->countInvoices($this->project_id, 'project', 'all-unpaid'); $this->data['debug'][] = $this->invoices_model->debug_data; $this->data['vars']['count_invoices_due'] = $this->invoices_model->countInvoices($this->project_id, 'project', 'due'); $this->data['debug'][] = $this->invoices_model->debug_data; $this->data['vars']['count_invoices_overdue'] = $this->invoices_model->countInvoices($this->project_id, 'project', 'overdue'); $this->data['debug'][] = $this->invoices_model->debug_data; $this->data['vars']['count_invoices_paid'] = $this->invoices_model->countInvoices($this->project_id, 'project', 'paid'); $this->data['debug'][] = $this->invoices_model->debug_data; //various sums for the side menu $this->data['vars']['sum_invoices_all'] = $this->invoices_model->sumInvoices($this->project_id, 'project', 'all'); $this->data['debug'][] = $this->invoices_model->debug_data; $this->data['vars']['sum_invoices_open'] = $this->invoices_model->sumInvoices($this->project_id, 'project', 'open'); $this->data['debug'][] = $this->invoices_model->debug_data; $this->data['vars']['sum_invoices_due'] = $this->invoices_model->sumInvoices($this->project_id, 'project', 'due'); $this->data['debug'][] = $this->invoices_model->debug_data; $this->data['vars']['sum_invoices_overdue'] = $this->invoices_model->sumInvoices($this->project_id, 'project', 'overdue'); $this->data['debug'][] = $this->invoices_model->debug_data; $this->data['vars']['sum_invoices_paid'] = $this->invoices_model->sumInvoices($this->project_id, 'project', 'paid'); $this->data['debug'][] = $this->invoices_model->debug_data; $this->data['vars']['sum_invoices_part_paid'] = $this->invoices_model->sumInvoices($this->project_id, 'project', 'partpaid'); $this->data['debug'][] = $this->invoices_model->debug_data; //side menu $this->data['vars']["css_menu_side_invoices_{$invoice_status}"] = 'side-menu-active'; //visibility - show table or show nothing found if ($rows_count > 0 && !empty($this->data['blocks']['invoices'])) { $this->data['visible']['wi_invoices_table'] = 1; } else { $this->notifications('wi_tabs_notification', $this->data['lang']['lang_no_results_found']); } }
/** * load of this clients invoices */ function __clientInvoices() { /* --------------URI SEGMENTS--------------- * [example] * admin/client/1/invoices/asc/sortby_id/due/2 * (2)->controller * (3)->client id * (4)->router * (5)->sort_order * (6)->sort_by_column * (7)->status ['new', 'due', 'paid', 'part-paid', 'overdue', 'all'] * (8)->offset ** -----------------------------------------*/ //profiling $this->data['controller_profiling'][] = __FUNCTION__; //uri segments $client_id = $this->uri->segment(3); $sort_by = $this->uri->segment(5) == 'desc' ? 'desc' : 'asc'; $sort_by_column = $this->uri->segment(6) == '' ? 'sortby_due_date' : $this->uri->segment(6); $status = $this->uri->segment(7) == '' ? 'all' : $this->uri->segment(7); $offset = is_numeric($this->uri->segment(8)) ? $this->uri->segment(8) : 0; //get results and save for tbs block merging $this->data['reg_blocks'][] = 'client_invoices'; $this->data['blocks']['client_invoices'] = $this->invoices_model->searchInvoices($offset, 'search', $client_id, 'client', $status); $this->data['debug'][] = $this->invoices_model->debug_data; //count results rows - used by pagination class $rows_count = $this->invoices_model->searchInvoices($offset, 'count', $client_id, 'client', $status); $this->data['debug'][] = $this->invoices_model->debug_data; //pagination $config = pagination_default_config(); $config['base_url'] = site_url("admin/client/{$client_id}/invoices/{$sort_by}/{$sort_by_column}/{$status}"); $config['total_rows'] = $rows_count; $config['per_page'] = $this->data['settings_general']['results_limit']; $config['uri_segment'] = 8; //the offset var $this->pagination->initialize($config); $this->data['vars']['pagination'] = $this->pagination->create_links(); //sorting links for menus on the top of the table $link_sort_by = $sort_by == 'asc' ? 'desc' : 'asc'; //flip the sort_by $link_sort_by_column = array('sortby_id', 'sortby_date', 'sortby_due_date', 'sortby_amount', 'sortby_amount_paid', 'sortby_amount_due', 'sortby_status'); foreach ($link_sort_by_column as $column) { $this->data['vars'][$column] = site_url("admin/client/{$client_id}/invoices/{$link_sort_by}/{$column}/{$status}/{$offset}"); } //visibility if ($rows_count > 0) { //show side menu $this->data['visible']['wi_client_invoices'] = 1; $this->data['visible']['wi_client_invoices_menu'] = 1; } else { //show mothing found $this->notifications('wi_tabs_notification', $this->data['lang']['lang_no_invoices_have_been_found']); $this->data['visible']['wi_client_invoices_menu'] = 1; } }