/** * Adds a new term * * @acess public * @param string $term Term * @param string $fast_url * @param string $desc Term's description * @return mixed Returns true if term was added or Jaws_Error on error */ function NewTerm($term, $fast_url, $desc) { $fast_url = empty($fast_url) ? $term : $fast_url; $fast_url = $this->GetRealFastUrl($fast_url, 'glossary'); $now = Jaws_DB::getInstance()->date(); $params['term'] = $term; $params['fast_url'] = $fast_url; $params['description'] = $desc; $params['createtime'] = $now; $params['updatetime'] = $now; $glossaryTable = Jaws_ORM::getInstance()->table('glossary'); $result = $glossaryTable->insert($params)->exec(); if (Jaws_Error::IsError($result)) { $GLOBALS['app']->Session->PushLastResponse(_t('GLOSSARY_ERROR_TERM_NOT_CREATED'), RESPONSE_ERROR); return new Jaws_Error(_t('GLOSSARY_ERROR_TERM_NOT_CREATED')); } $GLOBALS['app']->Session->PushLastResponse(_t('GLOSSARY_TERM_ADDED'), RESPONSE_NOTICE); $glossaryTable = Jaws_ORM::getInstance()->table('glossary'); $row = $glossaryTable->select('id:integer')->where('createtime', $now)->fetchRow(); if (Jaws_Error::IsError($row)) { $GLOBALS['app']->Session->PushLastResponse(_t('GLOSSARY_ERROR_TERM_NOT_CREATED'), RESPONSE_ERROR); return new Jaws_Error(_t('GLOSSARY_ERROR_TERM_NOT_CREATED')); } if (isset($row['id'])) { return $row['id']; } return false; }
/** * Upgrades the gadget * * @access public * @param string $old Current version (in registry) * @param string $new New version (in the $gadgetInfo file) * @return mixed True on success, Jaws_Error otherwise */ function Upgrade($old, $new) { if (version_compare($old, '2.0.0', '<')) { $variables = array(); $variables['logon_hours'] = str_pad('', 42, 'F'); $result = $this->installSchema('schema.xml', $variables, '1.0.0.xml'); if (Jaws_Error::IsError($result)) { return $result; } // update users passwords $usersTable = Jaws_ORM::getInstance()->table('users'); $usersTable->update(array('password' => $usersTable->concat(array('{SSHA1}', 'text'), 'password')))->where($usersTable->length('password'), 32, '>')->exec(); $usersTable->update(array('password' => $usersTable->concat(array('{MD5}', 'text'), 'password')))->where($usersTable->length('password'), 32)->exec(); // ACL keys $this->gadget->acl->insert('ManageFriends'); $this->gadget->acl->insert('AccessDashboard'); $this->gadget->acl->insert('ManageDashboard'); } if (version_compare($old, '2.1.0', '<')) { $this->gadget->registry->delete('anon_repetitive_email'); } if (version_compare($old, '2.2.0', '<')) { $result = $this->installSchema('schema.xml', '', '2.1.0.xml'); if (Jaws_Error::IsError($result)) { return $result; } } return true; }
/** * Fetches number of events per month * * @access public * @param int $user User ID * @return array Query result */ function GetYearEvents($user = null, $shared = null, $foreign = null, $year) { $table = Jaws_ORM::getInstance()->table('ec_events as events'); $jdate = Jaws_Date::getInstance(); $eventsByMonth = array(); for ($m = 1; $m <= 12; $m++) { $table->reset(); $table->select('events.id'); $table->join('ec_recurrences as recs', 'events.id', 'recs.event'); $table->join('ec_users', 'events.id', 'ec_users.event'); if ($user !== null) { $table->where('ec_users.user', $user)->and(); } if ($shared === true) { $table->where('shared', true)->and(); $table->where('events.user', $user)->and(); } if ($foreign === true) { $table->where('ec_users.owner', $user, '<>')->and(); } $daysInMonth = $jdate->monthDays($year, $m); $start = $jdate->ToBaseDate($year, $m, 1); $start = $GLOBALS['app']->UserTime2UTC($start['timestamp']); $stop = $jdate->ToBaseDate($year, $m, $daysInMonth, 23, 59, 59); $stop = $GLOBALS['app']->UserTime2UTC($stop['timestamp']); $table->where('recs.start_time', $stop, '<')->and(); $table->where('recs.stop_time', $start, '>'); $table->groupBy('events.id'); $eventsByMonth[$m] = count($table->fetchAll()); } return $eventsByMonth; }
/** * Delete many group * * @access public * @returns array of Address Books or Jaws_Error on error */ function DeleteGroups($groups, $user) { $agModel = $this->gadget->model->load('AddressBookGroup'); $agModel->DeleteAddressForGroups($groups, $user); $aTable = Jaws_ORM::getInstance()->table('address_group'); return $aTable->delete()->where('user', (int) $user)->and()->where('id', $groups, 'in')->exec(); }
/** * Returns an array with the results of a tag content * * @access public * @param string $action Action name * @param array $references Array of References * @return array An array of entries that matches a certain pattern */ function Execute($action, $references) { if (empty($action) || !is_array($references) || empty($references)) { return false; } $table = Jaws_ORM::getInstance()->table('blog'); $table->select('id:integer', 'fast_url', 'title', 'summary', 'text', 'updatetime'); $result = $table->where('id', $references, 'in')->fetchAll(); if (Jaws_Error::IsError($result)) { return array(); } $date = Jaws_Date::getInstance(); $posts = array(); foreach ($result as $r) { $post = array(); $post['title'] = $r['title']; $post['url'] = $this->gadget->urlMap('SingleView', array('id' => $r['fast_url'])); $post['outer'] = false; $post['image'] = 'gadgets/Blog/Resources/images/logo.png'; $post['snippet'] = $r['summary']; $post['date'] = $date->ToISO($r['updatetime']); $posts[$r['id']] = $post; } return $posts; }
/** * Sends email to user * * @access public * @param string $name Name * @param string $email Email address * @param string $company * @param string $url * @param string $tel * @param string $fax * @param string $mobile * @param string $address * @param string $rcipient Rcipient ID * @param string $subject Subject of message * @param string $attachment Attachment filename * @param string $message Message content * @return bool True on Success or False on Failure */ function InsertContact($name, $email, $company, $url, $tel, $fax, $mobile, $address, $recipient, $subject, $attachment, $message) { $now = Jaws_DB::getInstance()->date(); $data = array(); $data['[user]'] = $GLOBALS['app']->Session->GetAttribute('user'); $data['ip'] = $_SERVER['REMOTE_ADDR']; $data['name'] = $name; $data['email'] = $email; $data['company'] = $company; $data['url'] = $url; $data['tel'] = $tel; $data['fax'] = $fax; $data['mobile'] = $mobile; $data['address'] = $address; $data['recipient'] = (int) $recipient; $data['subject'] = $subject; $data['attachment'] = $attachment; $data['msg_txt'] = $message; $data['reply'] = ''; $data['reply_sent'] = 0; $data['createtime'] = $now; $data['updatetime'] = $now; $cntctTable = Jaws_ORM::getInstance()->table('contacts'); $result = $cntctTable->insert($data)->exec(); if (Jaws_Error::IsError($result)) { return false; } $GLOBALS['app']->Session->SetCookie('visitor_name', $name, 60 * 24 * 150); $GLOBALS['app']->Session->SetCookie('visitor_email', $email, 60 * 24 * 150); $GLOBALS['app']->Session->SetCookie('visitor_url', $url, 60 * 24 * 150); return $result; }
/** * Fetches files having specific tag * * @access public * @param string $action Action name * @param array $references Array of References * @return array An array of entries that matches a certain pattern */ function Execute($action, $references) { if (empty($action) || !is_array($references) || empty($references)) { return false; } $table = Jaws_ORM::getInstance()->table('directory'); $table->select('id:integer', 'title', 'description', 'update_time'); $result = $table->where('hidden', false)->and()->where('id', $references, 'in')->fetchAll(); if (Jaws_Error::IsError($result)) { return array(); } $date = Jaws_Date::getInstance(); $files = array(); foreach ($result as $r) { $file = array(); $file['title'] = $r['title']; $file['url'] = $this->gadget->urlMap('Directory', array('id' => $r['id'])); $file['outer'] = false; $file['image'] = 'gadgets/Directory/Resources/images/logo.png'; $file['snippet'] = $r['description']; $file['date'] = $date->ToISO($r['update_time']); $files[$r['id']] = $file; } return $files; }
/** * Get entries as Moblog * * @access public * @return mixed Returns an array of phoo entries in moblog format and Jaws_Error on error */ function GetMoblog($album) { $table = Jaws_ORM::getInstance()->table('phoo_image_album'); $table->select('phoo_album_id', 'filename', 'phoo_image.id', 'phoo_image.title', 'phoo_image.description', 'phoo_image.createtime'); $table->join('phoo_image', 'phoo_image.id', 'phoo_image_album.phoo_image_id'); $table->join('phoo_album', 'phoo_album.id', 'phoo_image_album.phoo_album_id'); $table->where('phoo_image.published', true)->and(); $table->where('phoo_album.id', $album); $table->orderBy('phoo_image.createtime desc'); $limit = $this->gadget->registry->fetch('moblog_limit'); if (Jaws_Error::isError($limit)) { return new Jaws_Error(_t('PHOO_ERROR_GETMOBLOG')); } $result = $table->limit($limit)->fetchAll(); if (Jaws_Error::IsError($result)) { return new Jaws_Error(_t('PHOO_ERROR_GETMOBLOG')); } foreach ($result as $key => $image) { $result[$key]['name'] = $image['title']; $result[$key]['thumb'] = $this->GetThumbPath($image['filename']); $result[$key]['medium'] = $this->GetMediumPath($image['filename']); $result[$key]['image'] = $this->GetOriginalPath($image['filename']); $result[$key]['stripped_description'] = $image['description']; } return $result; }
/** * Fetches number of total events * * @access public * @param int $user User ID * @return array Query result */ function GetNumberOfEvents($user = null, $query = null, $shared = null, $foreign = null, $start = null, $stop = null) { $table = Jaws_ORM::getInstance()->table('ec_events as event'); $table->select('count(event.id)'); $table->join('ec_users', 'event.id', 'event'); $table->join('users', 'owner', 'users.id'); if ($user !== null) { $table->where('ec_users.user', $user)->and(); } if ($shared === true) { $table->where('shared', true)->and(); $table->where('event.user', $user)->and(); } if ($foreign === true) { $table->where('ec_users.owner', $user, '<>')->and(); } if ($query !== null) { $query = "%{$query}%"; $table->openWhere('subject', $query, 'like')->or(); $table->where('location', $query, 'like')->or(); $table->closeWhere('description', $query, 'like')->and(); } $jdate = Jaws_Date::getInstance(); if (!empty($start)) { $start = $jdate->ToBaseDate(preg_split('/[- :]/', $start), 'Y-m-d'); $start = $GLOBALS['app']->UserTime2UTC($start); $table->where('stop_time', $start, '>')->and(); } if (!empty($stop)) { $stop = $jdate->ToBaseDate(preg_split('/[- :]/', $stop), 'Y-m-d'); $stop = $GLOBALS['app']->UserTime2UTC($stop); $table->where('start_time', $stop, '<'); } return $table->fetchOne(); }
/** * Returns an array with the results of a tag content * * @access public * @param string $action Action name * @param array $references Array of References * @return array An array of entries that matches a certain pattern */ function Execute($action, $references) { if (empty($action) || !is_array($references) || empty($references)) { return false; } $sptTable = Jaws_ORM::getInstance()->table('static_pages_translation'); $sptTable->select('page_id:integer', 'group_id', 'title', 'content', 'language', 'fast_url', 'static_pages_translation.updated'); $sptTable->join('static_pages', 'static_pages.page_id', 'static_pages_translation.base_id'); $result = $sptTable->where('translation_id', $references, 'in')->fetchAll(); if (Jaws_Error::IsError($result)) { return array(); } $date = Jaws_Date::getInstance(); $pages = array(); foreach ($result as $p) { if (!$this->gadget->GetPermission('AccessGroup', $p['group_id'])) { continue; } $page = array(); $page['title'] = $p['title']; $url = $this->gadget->urlMap('Page', array('pid' => empty($p['fast_url']) ? $p['page_id'] : $p['fast_url'], 'language' => $p['language'])); $page['url'] = $url; $page['image'] = 'gadgets/StaticPage/Resources/images/logo.png'; $page['snippet'] = $p['content']; $page['date'] = $date->ToISO($p['updated']); $pages[$p['page_id']] = $page; } return $pages; }
/** * Returns an array with the results of a tag content * * @access public * @param string $action Action name * @param array $references Array of References * @return array An array of entries that matches a certain pattern */ function Execute($action, $references) { if (empty($action) || !is_array($references) || empty($references)) { return false; } $table = Jaws_ORM::getInstance()->table('linkdump_links'); $table->select('id:integer', 'title', 'description', 'updatetime'); $result = $table->where('id', $references, 'in')->fetchAll(); if (Jaws_Error::IsError($result)) { return array(); } $date = Jaws_Date::getInstance(); $links = array(); foreach ($result as $r) { $link = array(); $link['title'] = $r['title']; $link['url'] = $this->gadget->urlMap('Link', array('id' => $r['id'])); $link['outer'] = true; $link['image'] = 'gadgets/LinkDump/Resources/images/logo.png'; $link['snippet'] = $r['description']; $link['date'] = $date->ToISO($r['updatetime']); $links[$r['id']] = $link; } return $links; }
/** * Updates users of a event * * @access public * @param int $id Event ID * @param array $users Set of User IDs * @return mixed True or Jaws_Error */ function UpdateEventUsers($id, $users) { // Update shared status of the event $shared = !empty($users); $table = Jaws_ORM::getInstance()->table('ec_events'); $table->beginTransaction(); $table->update(array('shared' => $shared)); $res = $table->where('id', $id)->exec(); if (Jaws_Error::IsError($res)) { return $res; } // Delete current users except owner $uid = (int) $GLOBALS['app']->Session->GetAttribute('user'); $table = Jaws_ORM::getInstance()->table('ec_users'); $table->delete()->where('event', $id)->and(); $res = $table->where('user', $uid, '<>')->exec(); if (Jaws_Error::IsError($res)) { return $res; } // Insert users if (!empty($users)) { foreach ($users as &$user) { $user = array('event' => $id, 'user' => $user, 'owner' => $uid); } $table = Jaws_ORM::getInstance()->table('ec_users'); $table->reset(); $table->insertAll(array('event', 'user', 'owner'), $users); $res = $table->exec(); if (Jaws_Error::IsError($res)) { return $res; } } $table->commit(); }
/** * Get AlbumGroup list with group information * * @access public * @param int $album Album ID * @return mixed array with the groups or Jaws_Error on error */ function GetAlbumGroupsInfo($album) { $table = Jaws_ORM::getInstance()->table('phoo_album_group'); $table->select('phoo_album_group.group', 'phoo_group.name', 'phoo_group.fast_url'); $table->join('phoo_group', 'phoo_album_group.group', 'phoo_group.id'); $table->where('album', $album); return $table->fetchAll(); }
/** * Creates shortcuts of the file for passed users * * @access public * @param int $id File ID * @param array $users Users ID's * @return mixed True or Jaws_Error */ function UpdateFileUsers($id, $users) { $table = Jaws_ORM::getInstance()->table('directory'); // Fetch file info $table->select('is_dir:boolean', 'title', 'description', 'filename', 'filetype', 'filesize', 'url', 'updatetime', 'user', 'owner', 'reference', 'shared:boolean'); $file = $table->where('id', $id)->fetchRow(); if (Jaws_Error::IsError($file)) { return $file; } // Fetch file users $table->reset(); $table->select('user'); $table->where('reference', $id); $current_users = $table->fetchColumn(); if (Jaws_Error::IsError($current_users)) { return $current_users; } $old_ids = array_diff($current_users, $users); $new_ids = array_diff($users, $current_users); // Delete old shortcuts if (!empty($old_ids)) { $table->reset(); $table->delete(); $table->where('reference', $id)->and(); $table->where('user', $old_ids, 'in'); $res = $table->exec(); if (Jaws_Error::IsError($res)) { return $res; } } // Create new shortcuts if (!empty($new_ids)) { $shortcut = $file; $shortcut['parent'] = 0; $shortcut['shared'] = false; $shortcut['reference'] = !empty($file['reference']) ? $file['reference'] : $id; $shortcut['createtime'] = time(); foreach ($new_ids as $uid) { $shortcut['user'] = $uid; $table->reset(); $res = $table->insert($shortcut)->exec(); if (Jaws_Error::IsError($res)) { return $res; } } } // Update `shared` status $shared = !empty($users); if ($file['shared'] !== $shared) { $table->reset(); $table->update(array('shared' => $shared)); $res = $table->where('id', $id)->exec(); if (Jaws_Error::IsError($res)) { return $res; } } return true; }
/** * Get a list of all the terms * * @access public * @return mixed Returns an array with all the terms or Jaws_Error on error */ function GetTerms() { $glossaryTable = Jaws_ORM::getInstance()->table('glossary'); $result = $glossaryTable->select('id:integer', 'user_id:integer', 'term', 'fast_url', 'description', 'updatetime')->orderBy('term')->fetchAll(); if (Jaws_Error::IsError($result)) { return new Jaws_Error($result->getMessage()); } return $result; }
/** * Delete a layout * * @access public * @param string $layout Layout name * @param int $user (Optional)User's ID * @return bool Returns true if layout was removed otherwise it returns Jaws_Error */ function DeleteLayout($layout, $user = 0) { $lyTable = Jaws_ORM::getInstance()->table('layout'); $lyTable->delete()->where('layout', $layout); if (!empty($user)) { $lyTable->and()->where('user', (int) $user); } return $lyTable->exec(); }
/** * Deletes all comments of a certain gadget/reference * * @access public * @param string $gadget Gadget name * @param int $reference Gadget reference id * @return mixed True on success and Jaws_Error on failure */ function DeleteGadgetComments($gadget, $reference = '') { $commentTable = Jaws_ORM::getInstance()->table('comments'); $commentTable->delete()->where('gadget', $gadget); if (!empty($reference)) { $commentTable->and()->where('reference', (int) $reference); } return $commentTable->exec(); }
/** * Returns the real path of an alias(given path), if no alias is found * it returns false * * @access public * @param string $alias Alias * @return mixed Real path(URL) or false */ function GetAliasPath($alias) { $aliasesTable = Jaws_ORM::getInstance()->table('url_aliases'); $result = $aliasesTable->select('real_url')->where('alias_hash', md5($alias))->fetchOne(); if (Jaws_Error::IsError($result) || empty($result)) { return false; } return $result; }
/** * Checks if hash already exists or not * * @access public * @param string $url_hash URL HASH value * @return bool Exists/Doesn't exists */ function ErrorMapExists($url_hash) { $urlerrorsTable = Jaws_ORM::getInstance()->table('url_errors'); $result = $urlerrorsTable->select('count([id]):integer')->where('url_hash', $url_hash)->fetchOne(); if (Jaws_Error::IsError($result)) { return $result; } return $result == '0' ? false : true; }
/** * Delete user's layouts * * @access public * @param int $user User's ID * @param bool $index Index layout * @return bool Returns true if layouts was removed otherwise it returns Jaws_Error */ function DeleteUserLayouts($user, $index = null) { $lyTable = Jaws_ORM::getInstance()->table('layout'); $lyTable->delete()->where('user', (int) $user); if (!is_null($index)) { $lyTable->and()->where('index', (bool) $index); } return $lyTable->exec(); }
/** * Gets list of available webcams * * @access public * @param mixed $limit Limit of data to retrieve (false = return all) * @return mixed Array of webcams or Jaws_Error on failure */ function GetWebCams($limit = false) { $webcamTable = Jaws_ORM::getInstance()->table('webcam'); $webcamTable->select('id:integer', 'title', 'url', 'refresh:integer')->orderBy('title'); $result = $webcamTable->limit($limit)->fetchAll(); if (Jaws_Error::IsError($result)) { return new Jaws_Error($result->getMessage()); } return $result; }
/** * Delete a group * * @access public * @param int $gid Group ID * @return mixed True if query was successful or Jaws_Error on error */ function DeleteGroup($gid) { $table = Jaws_ORM::getInstance()->table('forums_groups'); $subQuery = Jaws_ORM::getInstance()->table('forums')->select('count(id)')->where('gid', $gid); $res = $table->delete()->where('id', $gid)->and()->where($subQuery, '0')->exec(); if (Jaws_Error::IsError($res)) { return $res; } return (bool) $res; }
/** * Get information of an emblem * * @access public * @param int $id Emblem ID * @return mixed Array of emblem data and Jaws_Error on error */ function GetEmblem($id) { $emblemTable = Jaws_ORM::getInstance()->table('emblem'); $emblemTable->select('id:integer', 'title', 'image', 'url', 'type'); $res = $emblemTable->where('id', $id)->fetchRow(); if (Jaws_Error::IsError($res)) { return new Jaws_Error($res->getMessage()); } return $res; }
/** * Returns array of groups and properties * * @access public * @param bool $onlyPublished * @return mixed Array of groups and properties or Jaws_Error on error */ function GetGroups($onlyPublished = false) { $table = Jaws_ORM::getInstance()->table('forums_groups'); $table->select('id:integer', 'title', 'description', 'fast_url', 'order:integer', 'locked:boolean', 'published:boolean'); if ($onlyPublished) { $table->where('published', true); } $result = $table->orderBy('order asc')->fetchAll(); return $result; }
/** * Deletes an answer * * @access public * @param int $aid Answer's ID * @return mixed True if the answer was deleted and Jaws_Error on error */ function DeleteAnswer($aid) { $table = Jaws_ORM::getInstance()->table('poll_answers'); $result = $table->delete()->where('id', $aid)->exec(); if (Jaws_Error::IsError($result)) { $GLOBALS['app']->Session->PushLastResponse(_t('POLL_ERROR_ANSWER_NOT_DELETED'), RESPONSE_ERROR); return new Jaws_Error(_t('POLL_ERROR_ANSWER_NOT_DELETED')); } return true; }
/** * Delete a friend from the DB * * @access public * @param itn $id Friend's ID * @return mixed True if query is successful, if not, returns Jaws_Error on any error */ function DeleteFriend($id) { $friendTable = Jaws_ORM::getInstance()->table('friend'); $result = $friendTable->delete()->where('id', $id)->exec(); if (Jaws_Error::IsError($result)) { $GLOBALS['app']->Session->PushLastResponse(_t('FRIENDS_ERROR_NOT_DELETED'), RESPONSE_ERROR); return new Jaws_Error(_t('FRIENDS_ERROR_NOT_UPDATED')); } $GLOBALS['app']->Session->PushLastResponse(_t('FRIENDS_DELETED'), RESPONSE_NOTICE); return true; }
/** * Deletes the specified region * * @access public * @param int $id Region ID * @return mixed True on success and Jaws_Error on failure */ function DeleteRegion($id) { $weatherTable = Jaws_ORM::getInstance()->table('weather'); $result = $weatherTable->delete()->where('id', $id)->exec(); if (Jaws_Error::IsError($result)) { $GLOBALS['app']->Session->PushLastResponse(_t('WEATHER_ERROR_REGION_NOT_DELETED'), RESPONSE_ERROR); return new Jaws_Error(_t('WEATHER_ERROR_REGION_NOT_DELETED')); } $GLOBALS['app']->Session->PushLastResponse(_t('WEATHER_REGION_DELETED'), RESPONSE_NOTICE); return true; }
/** * Get groups * * @access public * @param $term Search term(searched in username, nickname and email) * @return array Returns an array of the available groups */ function GetGroups($term) { $groupsTable = Jaws_ORM::getInstance()->table('groups'); $groupsTable->select('id:integer', 'name', 'title', 'description', 'enabled:boolean'); $term = Jaws_UTF8::strtolower($term); $groupsTable->where('enabled', true); $groupsTable->and()->openWhere('lower(name)', '%' . $term . '%', 'like'); $groupsTable->or()->closeWhere('lower(title)', '%' . $term . '%', 'like'); $groupsTable->orderBy('name'); return $groupsTable->fetchAll(); }
/** * Get a list of the available Recipients * * @access public * @param bool $onlyVisible * @param bool $limit * @param bool $offset * @return mixed Array of Recipients or Jaws_Error on failure */ function GetRecipients($onlyVisible = false, $limit = false, $offset = null) { $rcpTable = Jaws_ORM::getInstance()->table('contacts_recipients'); $rcpTable->select('id:integer', 'name', 'email', 'tel', 'fax', 'mobile', 'visible:integer'); if ($onlyVisible) { $rcpTable->where('visible', 1); } $rcpTable->orderBy('id'); $rcpTable->limit($limit, $offset); return $rcpTable->fetchAll(); }
/** * Generates a tag cloud * * @access public * @return mixed An array on success and Jaws_Error in case of errors */ function CreateTagCloud() { $table = Jaws_ORM::getInstance()->table('blog_entrycat'); $table->select('count(category_id) as howmany:integer', 'name', 'fast_url', 'category_id:integer'); $table->join('blog_category', 'category_id', 'id'); $res = $table->groupBy('category_id', 'name', 'fast_url')->orderBy('name')->fetchAll(); if (Jaws_Error::isError($res)) { return new Jaws_Error(_t('BLOG_ERROR_TAGCLOUD_CREATION_FAILED')); } return $res; }