/** * 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_index($handler_id, $args, &$data) { $this->_request_data['name'] = "fi.kilonkipinat.account"; $this->_update_breadcrumb_line($handler_id); $title = $this->_l10n_midcom->get('index'); $_MIDCOM->set_pagetitle(":: {$title}"); $root_group_guid = $this->_config->get('root_group_to_show'); $persons = array(); if (isset($root_group_guid) && $root_group_guid != null && $root_group_guid != '') { $root_group = new midcom_db_group($root_group_guid); if ($root_group && $root_group->guid == $root_group_guid) { $mc_members = midcom_db_member::new_collector('gid', $root_group->id); $mc_members->add_value_property('uid'); $mc_members->execute(); $member_guids = $mc_members->list_keys(); $member_ids = array(); foreach ($member_guids as $guid => $array) { $member_ids[] = $mc_members->get_subkey($guid, 'uid'); } $qb_persons = fi_kilonkipinat_account_person_dba::new_query_builder(); $qb_persons->add_constraint('id', 'IN', $member_ids); $qb_persons->add_order('lastname', 'ASC'); $qb_persons->add_order('nickname', 'ASC'); $qb_persons->add_order('firstname', 'ASC'); $persons = $qb_persons->execute(); } } $this->_request_data['requests'] = ''; if ($_MIDCOM->auth->admin) { $regs_topic = midcom_helper_find_node_by_component('fi.kilonkipinat.accountregistration'); $regs_prefix = ''; if ($regs_topic) { $regs_prefix = $regs_topic['18']; } $mc = fi_kilonkipinat_accountregistration_accountrequest_dba::new_collector('status', FI_KILONKIPINAT_ACCOUNTREGISTRATION_ACCOUNT_STATUS_EMAILVALIDATED); // $mc->add_constraint('status', '=', fi_kilonkipinat_accountregistration_interface::FI_KILONKIPINAT_ACCOUNTREGISTRATION_ACCOUNT_STATUS_EMAILVALIDATED); $requests_count = $mc->count(); if ($requests_count > 0 && $regs_prefix != '') { $this->_request_data['requests'] = '<a href="' . $regs_prefix . 'list_pending/">' . $requests_count . ' tunnushakemusta</a>'; } } $this->_request_data['persons'] = $persons; return true; }
/** * Try to find a comments node (cache results) * * @access private */ function seek_comments(&$data) { if ($data['config']->get('comments_topic')) { // We have a specified photostream here $comments_topic = new midcom_db_topic($data['config']->get('comments_topic')); if (!is_object($comments_topic) || !isset($comments_topic->guid) || empty($comments_topic->guid)) { return false; } // We got a topic. Make it a NAP node $nap = new midcom_helper_nav(); $comments_node = $nap->get_node($comments_topic->id); return $comments_node; } // No comments topic specified, autoprobe $comments_node = midcom_helper_find_node_by_component('net.nehmer.comments'); // Cache the data if ($_MIDCOM->auth->request_sudo($data['topic']->component)) { $data['topic']->set_parameter($data['topic']->component, 'comments_topic', $comments_node[MIDCOM_NAV_GUID]); $_MIDCOM->auth->drop_sudo(); } return $comments_node; }
?> </td> </tr> <tr> <th>Parasta ennen</th> <td><?php echo fi_kilonkipinat_website::returnDate(strtotime($todo->deadline), 'short'); ?> </td> </tr> </table> <div id="fi_kilonkipinat_todos_todoitem_info_content"> <strong>Kuvaus:</strong> <?php echo $todo->content; ?> </div> <?php // No comments topic specified, autoprobe $comments_node = midcom_helper_find_node_by_component('net.nehmer.comments'); if ($comments_node) { $comments_url = $comments_node[MIDCOM_NAV_RELATIVEURL] . "comment/{$todo->guid}"; } ?> <div id="fi_kilonkipinat_todos_todoitem_comments"> <?php if (isset($comments_url)) { $_MIDCOM->dynamic_load($comments_url); } ?> </div> </div>
/** * Try to find the comments node (cache results) * @return object node which has the dataset comments * @access private */ function _seek_comments() { $comments_node = false; if ($this->_config->get('comments_topic_id')) { $nap = new midcom_helper_nav(); $comments_node = $nap->get_node($this->_config->get('comments_topic_id')); } else { // No comments topic specified, autoprobe $comments_node = midcom_helper_find_node_by_component('net.nehmer.comments'); } return $comments_node; }
<div id="imagery"> <div id="imagery_content"> <?php $mc_count = org_routamc_photostream_photo_dba::new_collector('sitegroup', $_MIDGARD['sitegroup']); $max_count = $mc_count->count(); $photostream_prefix = ''; $photostream_topic = midcom_helper_find_node_by_component('org.routamc.photostream'); if ($photostream_topic) { $photostream_prefix = $photostream_topic['18']; } function get_image_str_by_counter($max_count, $photostream_prefix) { $img_str = ''; $image_counter = rand(0, $max_count); $image_qb = org_routamc_photostream_photo_dba::new_query_builder(); $image_qb->set_limit(1); $image_qb->set_offset($image_counter - 1); $images = $image_qb->execute(); if (count($images) > 0) { $image = $images[0]; $qb_thumb = new midgard_query_builder('midgard_attachment'); $qb_thumb->add_constraint('parentguid', '=', $image->guid); $qb_thumb->add_constraint('parameter.domain', '=', 'midcom.helper.datamanager2.type.blobs'); $qb_thumb->add_constraint('parameter.name', '=', 'identifier'); $qb_thumb->add_constraint('parameter.value', '=', 'thumbnail'); $thumbs = $qb_thumb->execute(); if (count($thumbs) > 0) { $thumb = $thumbs[0]; $img_str = ''; if ($photostream_prefix != '') { $img_str = '<a title="' . $image->title . '" href="' . $photostream_prefix . 'photo/' . $image->guid . '/">';