/** * @param mixed $handler_id The ID of the handler. * @param Array $args The argument list. * @param Array &$data The local request data. */ public function _handler_list($handler_id, array $args, array &$data) { midcom::get('auth')->require_valid_user(); $siteconfig = org_openpsa_core_siteconfig::get_instance(); $this->_sales_url = $siteconfig->get_node_full_url('org.openpsa.sales'); $provider = new org_openpsa_widgets_grid_provider($this, 'local'); $provider->add_order('start'); $data['grid'] = $provider->get_grid('scheduled'); midcom::get('head')->set_pagetitle($this->_l10n->get('scheduled invoices')); $this->add_breadcrumb('', $this->_l10n->get('scheduled invoices')); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => '', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('dashboard'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_left.png')); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => 'invoice/new/', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create invoice'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/printer.png', MIDCOM_TOOLBAR_ENABLED => midcom::get('auth')->can_user_do('midgard:create', null, 'org_openpsa_invoices_invoice_dba'))); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => 'projects/', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('project invoicing'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/printer.png', MIDCOM_TOOLBAR_ENABLED => midcom::get('auth')->can_user_do('midgard:create', null, 'org_openpsa_invoices_invoice_dba'))); }
public function __toString() { if ($this->_provider) { $this->_provider->setup_grid(); } $string = '<table id="' . $this->_identifier . '"></table>'; $string .= '<div id="p_' . $this->_identifier . '"></div>'; $string .= '<script type="text/javascript">//<![CDATA[' . "\n"; $string .= $this->_prepend_js; $string .= 'org_openpsa_grid_helper.setup_grid("' . $this->_identifier . '", {'; $colnames = array(); foreach ($this->_columns as $name => $column) { if ($column['separate_index']) { $colnames[] = 'index_' . $name; } $colnames[] = $column['label']; } $string .= "\ncolNames: " . json_encode($colnames) . ",\n"; $string .= $this->_render_colmodel(); $total_options = sizeof($this->_options); $i = 0; foreach ($this->_options as $name => $value) { $string .= $name . ': ' . $value; if (++$i < $total_options) { $string .= ','; } $string .= "\n"; } $string .= "});\n"; if ($this->get_option('footerrow')) { $string .= 'jQuery("#' . $this->_identifier . '").jqGrid("footerData", "set", ' . json_encode($this->_footer_data) . ");\n"; } $string .= '//]]></script>'; return $string; }
/** * * @param mixed $handler_id The ID of the handler. * @param array &$data The local request data. */ public function _show_versions($handler_id, array &$data) { if ($this->_provider->count_rows() == 0) { return; } $data['grid'] = $this->_provider->get_grid('documents_grid'); midcom_show_style('show-document-grid'); }
/** * Handler method for listing users * * @param string $handler_id Name of the used handler * @param mixed $args Array containing the variable arguments passed to the handler * @param mixed &$data Data passed to the show method */ public function _handler_list($handler_id, array $args, array &$data) { $auth = midcom::get('auth'); if (!$auth->can_user_do('org.openpsa.user:access', null, 'org_openpsa_user_interface')) { $person = $auth->user->get_storage(); return new midcom_response_relocate('view/' . $person->guid . '/'); } $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX); $data['provider_url'] = $prefix . 'json/'; $grid_id = 'org_openpsa_user_grid'; if (sizeof($args) == 1) { $grid_id = 'org_openpsa_members_grid'; $this->_group = new org_openpsa_contacts_group_dba($args[0]); $data['group'] = $this->_group; $data['provider_url'] .= 'members/' . $this->_group->guid . '/'; } $data['grid'] = $this->_provider->get_grid($grid_id); org_openpsa_widgets_tree::add_head_elements(); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "create/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create person'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_person-new.png', MIDCOM_TOOLBAR_ENABLED => midcom::get('auth')->can_user_do('midgard:create', null, 'midcom_db_person'))); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "group/create/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create group'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_people-new.png', MIDCOM_TOOLBAR_ENABLED => midcom::get('auth')->can_user_do('midgard:create', null, 'midcom_db_group'))); }
/** * List all tasks, optionally filtered by status */ private function _handler_list_all($args) { // Default to open tasks list if none specified if (!isset($args[1]) || empty($args[1])) { $this->_request_data['view_identifier'] = 'open'; $args[1] = 'open'; } switch ($args[1]) { case 'agreement': if (!$args[2]) { throw new midcom_error('Invalid arguments for agreement filter'); } $agreement_id = (int) $args[2]; $this->_request_data['agreement'] = $agreement_id; $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($agreement_id); $title = sprintf($this->_l10n->get('tasks for agreement %s'), $deliverable->title); midcom::get('head')->set_pagetitle($title); $this->add_breadcrumb("", $title); $this->_qb->add_constraint('agreement', '=', $deliverable->id); $this->_provider->add_order('end', 'DESC'); break; case 'all': case 'both': $args[1] = 'all'; $this->_provider->add_order('end', 'DESC'); break; case 'open': $this->set_active_leaf($this->_topic->id . ':tasks_open'); $this->_qb->add_constraint('status', '<', org_openpsa_projects_task_status_dba::CLOSED); $this->_provider->add_order('end'); break; case 'closed': $this->set_active_leaf($this->_topic->id . ':tasks_closed'); $this->_qb->add_constraint('status', '=', org_openpsa_projects_task_status_dba::CLOSED); $this->_provider->add_order('end', 'DESC'); break; case 'current': $this->_qb->add_constraint('status', 'IN', array(org_openpsa_projects_task_status_dba::ACCEPTED, org_openpsa_projects_task_status_dba::STARTED, org_openpsa_projects_task_status_dba::REJECTED, org_openpsa_projects_task_status_dba::REOPENED)); $this->_provider->add_order('end'); break; case 'invoiceable': $this->set_active_leaf($this->_topic->id . ':tasks_invoiceable'); $this->_qb->add_constraint('invoiceableHours', '>', 0); $this->_provider->add_order('end'); break; case 'invoiced': $this->set_active_leaf($this->_topic->id . ':tasks_invoiced'); $this->_qb->add_constraint('invoicedHours', '>', 0); $this->_provider->add_order('end', 'DESC'); break; default: throw new midcom_error("Filter {$args[1]} not recognized"); } $qf = new org_openpsa_core_queryfilter('org_openpsa_task_list_' . $args[1]); $qf->add_filter(new org_openpsa_core_filter('priority', '<=', $this->_request_data['priority_array'])); $date_filter = new org_openpsa_core_filter('timeframe'); $date_filter->set('mode', 'timeframe'); $date_filter->set('helptext', $this->_l10n->get("timeframe")); $date_filter->set('fieldname', array('start' => 'start', 'end' => 'end')); $qf->add_filter($date_filter); $qf->apply_filters($this->_qb); $this->_request_data["qf"] = $qf; $this->_request_data['table-heading'] = $args[1] . ' tasks'; $this->_request_data['view'] = 'grid'; }
private function _show_invoice_list($type = 'all') { $this->_list_type = $type; $provider = new org_openpsa_widgets_grid_provider($this, 'local'); if ($provider->count_rows() == 0) { return; } switch ($this->_list_type) { case 'paid': $provider->add_order('paid', 'DESC'); break; case 'unsent': $provider->add_order('index_number'); break; case 'overdue': case 'open': $provider->add_order('due'); break; } $grid_id = $type . '_invoices_grid'; if ($this->_deliverable) { $grid_id = 'd_' . $this->_deliverable->id . $grid_id; $this->_request_data['totals']['deliverable'] = 0; } $this->_request_data['grid'] = $provider->get_grid($grid_id); $this->_request_data['list_type'] = $this->_list_type; $label = $type == 'all' ? 'invoices' : $type . ' invoices'; $this->_request_data['list_label'] = $this->_l10n->get($label); midcom_show_style('show-grid'); }