/**
  * Retrieved list of objects base on a given parameters - dynamic method: list_PaForumsUsers()
  *
  *
  * Generated with the DalClassGenerator created by: 
  * Zoran Hron <*****@*****.**> 
  *
  * @param conditionalStatement = null
  * @param orderby = null
  * @param sort = null
  * @param limit = 0
  * @param fetchmode = DB_FETCHMODE_OBJECT
  * @result array of objects: PaForumsUsers
  **/
 public function list_PaForumsUsers($conditionalStatement = null, $orderby = null, $sort = null, $limit = 0, $fetchmode = DB_FETCHMODE_OBJECT)
 {
     // build MySQL query
     $sql = "SELECT * FROM { pa_forums_users } ";
     if ($conditionalStatement) {
         $sql .= "WHERE {$conditionalStatement}";
     }
     if ($orderby) {
         $sql .= " ORDER BY {$orderby}";
     }
     if ($sort) {
         $sql .= " {$sort}";
     }
     if ($limit) {
         $sql .= " LIMIT {$limit}";
     }
     $sql .= ";";
     // execute query
     $res = Dal::query($sql);
     $objects = array();
     // data found?
     if ($res->numRows() > 0) {
         // retrieve data objects
         while ($row = $res->fetchRow($fetchmode)) {
             if ($fetchmode == DB_FETCHMODE_OBJECT) {
                 $obj = new PaForumsUsers();
                 $obj->populateFromObject($row);
                 $objects[] = $obj;
             } else {
                 $objects[] = $row;
             }
         }
     }
     return $objects;
 }
Example #2
0
 /**
  * Soft delete of user related data.
  * function to delete a user from the system.
  * this function uses the method of th respective api's to delete the user related data.
  */
 public static function delete_user($user_id)
 {
     Logger::log("Enter: function User::delete_user");
     // Delete user content on homepage: Call content delete.
     $uid = (int) $user_id;
     try {
         Content::delete_user_content($uid);
         // Deleting user groups.
         $Group = new Group();
         $Group->delete_user_groups($uid);
         // Deleting user albums.
         Album::delete_user_albums($uid);
         // Deleting user relations.
         Relation::delete_user_relations($uid);
         // Deleting user comments.
         Comment::delete_user_comments($uid);
         PaForumsUsers::delete_PaForumsUsers($uid);
         UserPopularity::deleteUserPopularity($uid);
     } catch (PAException $e) {
         Logger::log('Exception occured while deleting user:'******' : ' . $e->message);
         throw new PAException(INVALID_ARGUMENTS, "User deletion failed for user_id =  '{$uid}' due to '{$e->message}'");
     }
     Logger::log("Exit: function User::delete_user");
 }
: <?php 
echo PaForumPost::countPaForumPost("user_id = {$created_by->user_id}");
?>
 </div>
                          <div><?php 
echo __('Last login');
?>
: <?php 
echo PA::date($created_by->last_login, 'short');
?>
 </div>
                          <div><?php 
echo __('Status');
?>
: <?php 
echo PaForumsUsers::getStatusString($created_by->user_id);
?>
 </div>
                        </div>
                      </td>
                      <td class="post_odd">
                        <div class='forum_post'>
                          <?php 
echo $thread->get_content();
?>
                        </div>
                      </td>
                    </tr>
                    <tr>
                      <td class="post_date" width="<?php 
echo $avatar_size['width'];
 private function buildStatistics($board)
 {
     $board_statistics = $board->getBoardStatistics();
     $statistics = array();
     $statistics['title'] = $board->get_title();
     $statistics['description'] = $board->get_description();
     $statistics['type'] = $board->get_type() . " board";
     $statistics['created_at'] = $board->get_created_at();
     switch ($board->get_type()) {
         case PaForumBoard::network_board:
             $net_id = $board->get_owner_id();
             if ($net_id == 1) {
                 // mother network - owner_id always is '1' !
                 $owner_id = 1;
             } else {
                 $owner_id = Network::get_network_owner((int) $board->get_owner_id());
             }
             break;
         case PaForumBoard::group_board:
             $owner_id = Group::get_owner_id((int) $board->get_owner_id());
             break;
         case PaForumBoard::personal_board:
             $owner_id = $board->get_owner_id();
             break;
     }
     $user = new User();
     $user->load((int) $owner_id);
     $statistics['owner'] = $user;
     $statistics['nb_categories'] = $board_statistics['nb_categories'];
     $nb_forums = 0;
     $nb_threads = 0;
     $nb_posts = 0;
     $threads = array();
     $last_posts = array();
     foreach ($board_statistics['categories'] as $category) {
         if ($category->statistics['nb_forums'] > 0) {
             $nb_forums += $category->statistics['nb_forums'];
             foreach ($category->statistics['forums'] as $forum) {
                 if (!empty($forum->statistics['threads']) and count($forum->statistics['threads']) > 0) {
                     foreach ($forum->statistics['threads'] as &$thr) {
                         $thr->forum = $forum;
                     }
                     $threads = array_merge($threads, $forum->statistics['threads']);
                     $nb_threads += $forum->statistics['nb_threads'];
                     $nb_posts += $forum->statistics['nb_posts'];
                     if (!empty($forum->statistics['last_post'])) {
                         $last_posts[] = $forum->statistics['last_post'];
                     }
                 }
             }
         }
     }
     if (count($threads) > 1) {
         usort($threads, "cmpThreadCreated");
     }
     $statistics['threads'] = $threads;
     $statistics['nb_forums'] = $nb_forums;
     $statistics['nb_threads'] = $nb_threads;
     $statistics['nb_posts'] = $nb_posts;
     $statistics['last_posts'] = $last_posts;
     $statistics['nb_users'] = PaForumsUsers::countPaForumsUsers("board_id = " . $board->get_id());
     return $statistics;
 }
: <?php 
echo $post->user->user_id != -1 ? PaForumPost::countPaForumPost("user_id = " . $post->user->user_id) : '';
?>
 </div>
                <div><?php 
echo __('Last login');
?>
: <?php 
echo $post->user->user_id != -1 ? PA::date($post->user->last_login, 'short') : '';
?>
 </div>
                <div><?php 
echo __('Status');
?>
: <?php 
echo $post->user->user_id != -1 ? PaForumsUsers::getStatusString($post->user->user_id) : '';
?>
 </div>
              </div>
            </td>
            <td class="post_<?php 
echo $even_odd;
?>
">
              <div class='forum_post'>
                <?php 
echo $post->get_content();
?>
              </div>
            </td>
          </tr>