示例#1
0
    /*$close = (isset($_POST['close'])) ? true : false;
    	$id_list = request_var('id_list', array(0));
    
    	if ($close && sizeof($id_list))
    	{
    		$attention_object = new titania_attention;
    		foreach ($id_list as $attention_id)
    		{
    			$attention_object->attention_id = $attention_id;
    			$attention_object->load();
    		}
    	}*/
    switch ($type) {
        case 'reported':
            $type = TITANIA_ATTENTION_REPORTED;
            break;
        case 'unapproved':
            $type = TITANIA_ATTENTION_UNAPPROVED;
            break;
        default:
            $type = false;
            break;
    }
    $options = array('attention_type' => $type, 'display_closed' => $closed, 'only_closed' => !$open && $closed ? true : false);
    attention_overlord::display_attention_list($options);
    phpbb::$template->assign_vars(array('S_ACTION' => titania_url::build_url('manage/attention'), 'S_OPEN_CHECKED' => $open, 'S_CLOSED_CHECKED' => $closed));
    // Subscriptions
    titania_subscriptions::handle_subscriptions(TITANIA_ATTENTION, 0, titania_url::build_url('manage/attention'));
    titania::page_header('ATTENTION');
    titania::page_footer(true, 'manage/attention.html');
}
示例#2
0
    /**
     * Get the number of open attention items.
     *
     * @return int
     */
    protected function get_open_attention_count()
    {
        // Count the number of open attention items
        $sql = 'SELECT COUNT(a.attention_id) AS cnt
			FROM ' . TITANIA_ATTENTION_TABLE . ' a
			LEFT JOIN ' . TITANIA_CONTRIBS_TABLE . ' c
				ON (a.attention_object_type = ' . TITANIA_CONTRIB . '
					AND a.attention_object_id = c.contrib_id)
			WHERE a.attention_close_time = 0
				AND ' . \attention_overlord::get_permission_sql();
        $this->db->sql_query($sql);
        $attention_count = (int) $this->db->sql_fetchfield('cnt');
        $this->db->sql_freeresult();
        return $attention_count;
    }
示例#3
0
 /**
  * Load attention item.
  *
  * @param int $attention_id		Attention id.
  * @param int $object_type		Object type.
  * @param int $object_id			Object id.
  * @throws \Exception			Throws exception if no item found.
  *
  * @return null
  */
 protected function load_item($attention_id, $object_type = false, $object_id = false)
 {
     $this->attention = \attention_overlord::get_attention_object($attention_id, $object_type, $object_id);
     if (!$this->attention) {
         throw new \Exception($this->user->lang['NO_ATTENTION_ITEM']);
     }
     if (!$this->attention->load_source_object()) {
         $this->attention->delete();
         $error = array(TITANIA_POST => 'NO_POST', TITANIA_CONTRIB => 'NO_CONTRIB');
         throw new \Exception($error[$this->attention->attention_object_type]);
     }
 }