private function _list_products($limit = 5, $product_group = '') { $product_qb = new org_openpsa_qbpager('org_openpsa_products_product_dba', 'latest_products'); $this->_request_data['product_qb'] =& $product_qb; $product_qb->results_per_page = $limit; $product_qb->set_limit($limit); $product_qb->add_order('metadata.published', 'DESC'); if ($product_group != '') { $group_qb = org_openpsa_products_product_group_dba::new_query_builder(); $group_qb->add_constraint('code', '=', $product_group); $groups = $group_qb->execute(); if (count($groups) == 0) { return false; // No matching group } else { $categories_qb = org_openpsa_products_product_group_dba::new_query_builder(); $categories_qb->add_constraint('up', '=', $groups[0]->id); $categories = $categories_qb->execute(); $categories_in = array(); if (count($categories) == 0) { /* No matching categories belonging to this group * So we can search for the application using only * this group id */ $product_qb->add_constraint('productGroup', 'INTREE', $groups[0]->id); } else { for ($i = 0; $i < count($categories); $i++) { $categories_in[$i] = $categories[$i]->id; } $product_qb->add_constraint('productGroup', 'IN', $categories_in); } } } if ($this->_config->get('enable_scheduling')) { $product_qb->add_constraint('start', '<=', time()); $product_qb->begin_group('OR'); /* * List products that either have no defined end-of-market dates * or are still in market */ $product_qb->add_constraint('end', '=', 0); $product_qb->add_constraint('end', '>=', time()); $product_qb->end_group(); } $this->_request_data['products'] = $product_qb->execute(); $this->_request_data['product_group'] = $product_group; }
/** * Shows the loaded message. */ public function _show_list($handler_id, array &$data) { $qb = new org_openpsa_qbpager('org_openpsa_directmarketing_campaign_message_dba', 'campaign_messages'); $qb->results_per_page = 10; $qb->add_order('metadata.created', 'DESC'); $qb->add_constraint('campaign', '=', $this->_campaign->id); $ret = $qb->execute(); $data['qbpager'] =& $qb; midcom_show_style("show-message-list-header"); if (count($ret) > 0) { foreach ($ret as $message) { $this->_datamanager->autoset_storage($message); $data['message'] =& $message; $data['message_array'] = $this->_datamanager->get_content_html(); $data['message_class'] = org_openpsa_directmarketing_viewer::get_messagetype_css_class($message->orgOpenpsaObtype); midcom_show_style('show-message-list-item'); } } midcom_show_style("show-message-list-footer"); }
/** * * @param mixed $handler_id The ID of the handler. * @param array &$data The local request data. */ public function _show_action($handler_id, array &$data) { switch ($this->_view) { case "area_group_members": // This is most likely a dynamic_load $qb = new org_openpsa_qbpager('midcom_db_member', 'group_members'); $qb->add_constraint('gid', '=', $this->_request_data['group']->id); $qb->results_per_page = 10; $results = $qb->execute(); $this->_request_data['members_qb'] =& $qb; if (count($results) > 0) { midcom_show_style("show-group-persons-header"); foreach ($results as $member) { $this->_request_data['member'] = $member; if ($member->extra == "") { $member->extra = $this->_l10n->get('<title>'); } $this->_request_data['member_title'] = $member->extra; $this->_request_data['person'] = new org_openpsa_contacts_person_dba($member->uid); midcom_show_style("show-group-persons-item"); } midcom_show_style("show-group-persons-footer"); } break; case "area_group_subgroups": $qb = org_openpsa_contacts_group_dba::new_query_builder(); $qb->add_constraint('owner', '=', $this->_request_data['group']->id); $results = $qb->execute(); if (count($results) > 0) { midcom_show_style("show-group-subgroups-header"); foreach ($results as $subgroup) { $this->_request_data['subgroup'] = $subgroup; midcom_show_style("show-group-subgroups-item"); } midcom_show_style("show-group-subgroups-footer"); } break; } }
public function _handler_viewActivity($handler_id, $args, &$data) { $status = parent::_handler_read($handler_id, $args, $data); if ($_MIDGARD['user'] == $this->_person->id) { $this->_component_data['active_leaf'] = "own_details"; } $qb_latest = new org_openpsa_qbpager('midcom_helper_activitystream_activity_dba', 'activity'); $qb_latest->add_order('metadata.revised', 'DESC'); $qb_latest->add_constraint('actor', '=', $this->_object->id); $qb_latest->set_limit($this->_config->get('activity_results_per_page')); $qb_latest->results_per_page = $this->_config->get('activity_results_per_page'); $latest = $qb_latest->execute(); $this->_request_data['qb'] = $qb_latest; $this->_request_data['items'] = $latest; return $status; }
/** * * @param mixed $handler_id The ID of the handler. * @param Array $args The argument list. * @param Array &$data The local request data. * @return boolean Indicating success. */ function _handler_moderate($handler_id, array $args, array &$data) { midcom::get('auth')->require_valid_user(); if (!$this->_topic->can_do('net.nehmer.comments:moderation')) { return new midcom_response_relocate('/'); } // This might exit. $this->_process_admintoolbar(); $view_status = array(); $this->_request_data['handler'] = $args[0]; switch ($args[0]) { case 'reported_abuse': $this->_request_data['status_to_show'] = 'reported abuse'; $view_status[] = net_nehmer_comments_comment::REPORTED_ABUSE; break; case 'abuse': $this->_request_data['status_to_show'] = 'abuse'; $view_status[] = net_nehmer_comments_comment::ABUSE; break; case 'junk': $this->_request_data['status_to_show'] = 'junk'; $view_status[] = net_nehmer_comments_comment::JUNK; break; case 'latest': $this->_request_data['status_to_show'] = 'latest comments'; $view_status[] = net_nehmer_comments_comment::NEW_ANONYMOUS; $view_status[] = net_nehmer_comments_comment::NEW_USER; $view_status[] = net_nehmer_comments_comment::MODERATED; if ($this->_config->get('show_reported_abuse_as_normal')) { $view_status[] = net_nehmer_comments_comment::REPORTED_ABUSE; } break; case 'latest_new': $this->_request_data['status_to_show'] = 'latest comments, only new'; $view_status[] = net_nehmer_comments_comment::NEW_ANONYMOUS; $view_status[] = net_nehmer_comments_comment::NEW_USER; if ($this->_config->get('show_reported_abuse_as_normal')) { $view_status[] = net_nehmer_comments_comment::REPORTED_ABUSE; } break; case 'latest_approved': $this->_request_data['status_to_show'] = 'latest comments, only approved'; $view_status[] = net_nehmer_comments_comment::MODERATED; break; } $qb = new org_openpsa_qbpager('net_nehmer_comments_comment', 'net_nehmer_comments_comments'); $qb->results_per_page = $this->_config->get('items_to_show'); $qb->display_pages = $this->_config->get('paging'); $qb->add_constraint('status', 'IN', $view_status); $qb->add_order('metadata.revised', 'DESC'); $this->_comments = $qb->execute(); if ($this->_comments) { $this->_init_display_datamanager(); } net_nehmer_comments_viewer::add_head_elements(); $this->_prepare_request_data(); $this->add_breadcrumb('', $this->_l10n->get($data['status_to_show'])); }
/** * The handler for the index article. * * @param mixed $handler_id the array key from the request array * @param array $args the arguments given to the handler * @param Array &$data The local request data. * @return boolean Indicating success. */ function _handler_open($handler_id, $args, &$data) { $_MIDCOM->auth->require_valid_user(); $this->_request_data['name'] = "fi.kilonkipinat.todos"; $this->_component_data['active_leaf'] = "{$this->_topic->id}_LIST_OPEN"; $this->_update_breadcrumb_line($handler_id); $title = 'Nakit'; $_MIDCOM->set_pagetitle(":: {$title}"); $qb = new org_openpsa_qbpager('fi_kilonkipinat_todos_todoitem_dba', 'fi_kilonkipinat_todos_list_my'); $qb->add_constraint('person', '=', 0); $qb->add_constraint('grp', '=', 0); $qb->add_constraint('status', '<', FI_KILONKIPINAT_TODOS_TODOITEM_STATUS_ACKNOWLEDGED); $qb->add_order('deadline', 'ASC'); if ($handler_id == 'list_open_count') { $qb->results_per_page = $args[0]; } else { $qb->results_per_page = $this->_config->get('index_entries'); } $data['todoitems'] = $qb->execute(); $data['qb'] = $qb; $data['handler_id'] = $handler_id; return true; }