コード例 #1
0
	/**
	 * Test getTopics()
	 */
	public function testGetTopics() {
		list($count, $topics) = KunenaForumTopicHelper::getLatestTopics(false, 0, 20);
		$topicusers = KunenaForumTopicUserHelper::getTopics($topics);
		foreach ($topics as $topic) {
			$this->assertTrue(isset($topicusers[$topic->id]));
			$this->assertEquals($topic->id, $topicusers[$topic->id]->topic_id);
		}
	}
コード例 #2
0
ファイル: helper.php プロジェクト: GoremanX/Kunena-2.0
	/**
	 * Returns KunenaForumTopicUser object
	 *
	 * @access	public
	 * @param	identifier		The user topic to load - Can be only an integer.
	 * @return	KunenaForumTopicUser		The user topic object.
	 * @since	1.7
	 */
	static public function get($topic = null, $user = null, $reload = false) {
		if ($topic instanceof KunenaForumTopic) {
			$topic = $topic->id;
		}
		$topic = intval ( $topic );
		$user = KunenaUserHelper::get($user);

		if ($topic < 1)
			return new KunenaForumTopicUser (null, $user);

		if ($reload || empty ( self::$_instances [$user->userid][$topic] )) {
			self::$_instances [$user->userid][$topic] = self::$_topics [$topic][$user->userid] = array_pop(KunenaForumTopicUserHelper::getTopics ( $topic, $user ));
		}

		return self::$_instances [$user->userid][$topic];
	}
コード例 #3
0
ファイル: helper.php プロジェクト: anawu2006/PeerLearning
 /**
  * @param mixed $ids
  * @param mixed $user
  *
  * @return KunenaForumTopicUser[]
  */
 public static function getUserTopics($ids = false, $user = null)
 {
     if ($ids === false) {
         $ids = array_keys(self::$_instances);
     }
     return KunenaForumTopicUserHelper::getTopics($ids, $user);
 }