当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPWS_DB::setLimit方法代码示例

本文整理汇总了PHP中PHPWS_DB::setLimit方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_DB::setLimit方法的具体用法?PHP PHPWS_DB::setLimit怎么用?PHP PHPWS_DB::setLimit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPWS_DB的用法示例。


在下文中一共展示了PHPWS_DB::setLimit方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadFeeds

 public function loadFeeds()
 {
     $db = new PHPWS_DB('phpws_key');
     $db->addWhere('module', $this->module);
     $db->addWhere('active', 1);
     $db->addWhere('restricted', 0);
     $db->addWhere('show_after', time(), '<');
     $db->addWhere('hide_after', time(), '>');
     $db->addOrder('create_date desc');
     // rss limit is 15
     $db->setLimit('15');
     $result = $db->getObjects('Key');
     if (PHPWS_Error::isError($result)) {
         $this->_feeds = NULL;
         $this->_error = $result;
         return $result;
     } else {
         $this->_feeds = $result;
         return TRUE;
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:21,代码来源:Channel.php

示例2: random

 /**
  * Gets random page from the database
  *
  * @author Greg Meiste <greg.meiste+github@gmail.com>
  */
 function random()
 {
     $db = new PHPWS_DB('wiki_pages');
     $db->addOrder('random');
     $db->setLimit(1);
     $db->addColumn('title');
     $result = $db->select('col');
     if (!PHPWS_Error::logIfError($result) && $result != NULL) {
         PHPWS_Core::reroute(PHPWS_Text::linkAddress('wiki', array('page' => $result[0])));
     }
     PHPWS_Core::reroute(PHPWS_Text::linkAddress('wiki'));
 }
开发者ID:Jopperi,项目名称:wiki,代码行数:17,代码来源:WikiManager.php

示例3: loadDefaultSchedule

 public function loadDefaultSchedule()
 {
     $sch_id = PHPWS_Settings::get('calendar', 'public_schedule');
     if ($sch_id > 0) {
         $this->schedule = new Calendar_Schedule((int) $sch_id);
     } elseif ($sch_id == -1) {
         $this->schedule = new Calendar_Schedule();
     } else {
         $db = new PHPWS_DB('calendar_schedule');
         $db->addColumn('id');
         $db->addWhere('public', 1);
         $db->setLimit(1);
         $id = $db->select('one');
         if (PHPWS_Error::isError($id)) {
             PHPWS_Error::log($id);
             return;
         }
         if (empty($id)) {
             $id = -1;
         }
         PHPWS_Settings::set('calendar', 'public_schedule', $id);
         PHPWS_Settings::save('calendar');
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:24,代码来源:Calendar.php

示例4: autoForward

 public static function autoForward()
 {
     $current_url = PHPWS_Core::getCurrentUrl();
     if (preg_match('@pagesmith/\\d+@', $current_url)) {
         $page_name = str_replace('/', ':', $current_url);
         $db = new PHPWS_DB('access_shortcuts');
         $db->addColumn('keyword');
         $db->addWhere('url', $page_name);
         $db->setLimit(1);
         $keyword = $db->select('one');
         if (!empty($keyword)) {
             PHPWS_Core::reroute($keyword);
             exit;
         }
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:16,代码来源:Access.php

示例5: viewImage

 public function viewImage($id, $view_folder = true)
 {
     Layout::addStyle('filecabinet');
     PHPWS_Core::initModClass('filecabinet', 'Image.php');
     $image = new PHPWS_Image($id);
     $folder = new Folder($image->folder_id);
     if (!$folder->allow()) {
         $content = dgettext('filecabinet', 'Sorry, the file you requested is off limits.');
         Layout::add($content);
         return;
     }
     $tpl['TITLE'] = $image->title;
     if ($image->width > FC_MAX_IMAGE_POPUP_WIDTH || $image->height > FC_MAX_IMAGE_POPUP_HEIGHT) {
         if (FC_MAX_IMAGE_POPUP_WIDTH < FC_MAX_IMAGE_POPUP_HEIGHT) {
             $ratio = FC_MAX_IMAGE_POPUP_WIDTH / $image->width;
             $image->width = FC_MAX_IMAGE_POPUP_WIDTH;
             $image->height = $image->height * $ratio;
         } else {
             $ratio = FC_MAX_IMAGE_POPUP_HEIGHT / $image->height;
             $image->height = FC_MAX_IMAGE_POPUP_HEIGHT;
             $image->width = $image->width * $ratio;
         }
         $tpl['IMAGE'] = sprintf('<a href="%s">%s</a>', $image->getPath(), $image->getTag());
     } else {
         $tpl['IMAGE'] = $image->getTag();
     }
     $tpl['DESCRIPTION'] = $image->getDescription();
     $tpl['CLOSE'] = javascript('close_window');
     if ($view_folder && $folder->public_folder) {
         $db = new PHPWS_DB('images');
         $db->setLimit(1);
         $db->addWhere('folder_id', $image->folder_id);
         $db->addWhere('title', $image->title, '>');
         $db->addOrder('title');
         $next_img = $db->getObjects('PHPWS_Image');
         if (!empty($next_img)) {
             $next_link = Icon::show('next', dgettext('filecabinet', 'Next image'));
             $tpl['NEXT'] = sprintf('<a id="next-link" href="%s%s">%s</a>', PHPWS_Core::getHomeHttp(), $next_img[0]->popupAddress(), $next_link);
         }
         $db->resetWhere();
         $db->resetOrder();
         $db->addWhere('folder_id', $image->folder_id);
         $db->addWhere('title', $image->title, '<');
         $db->addOrder('title desc');
         $prev_img = $db->getObjects('PHPWS_Image');
         if (!empty($prev_img)) {
             $prev_link = Icon::show('previous', dgettext('filecabinet', 'Previous image'));
             $tpl['PREV'] = sprintf('<a id="prev-link" href="%s%s">%s</a>', PHPWS_Core::getHomeHttp(), $prev_img[0]->popupAddress(), $prev_link);
         }
     }
     $content = PHPWS_Template::process($tpl, 'filecabinet', 'image_view.tpl');
     Layout::nakedDisplay($content);
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:53,代码来源:Cabinet.php

示例6: loadLastExec

 /**
  * Loads the report instance for the last execution performed.
  * The loaded object will contain a null ID if the report has
  * never been executed. Returns true/false on success/failure.
  *
  * @throws DatabaseException
  * @return boolean
  */
 public function loadLastExec()
 {
     $db = new PHPWS_DB('hms_report');
     $db->addWhere('report', $this->getReportClassName());
     $db->addWhere('completed_timestamp', 'NULL', 'IS NOT');
     $db->addOrder('completed_timestamp DESC');
     $db->setLimit(1);
     $result = $db->loadObject($this->report);
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
     return true;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:21,代码来源:ReportController.php

示例7: whatsnewBlock

 public static function whatsnewBlock()
 {
     if (PHPWS_Settings::get('whatsnew', 'cache_timeout') > 0) {
         $cache_key = 'whatsnew_cache_key';
         $content = PHPWS_Cache::get($cache_key, PHPWS_Settings::get('whatsnew', 'cache_timeout'));
         if (!empty($content)) {
             return $content;
         }
     }
     $link = null;
     $summary = null;
     $date = null;
     $module_name = null;
     $exclude = unserialize(PHPWS_Settings::get('whatsnew', 'exclude'));
     $db = new PHPWS_DB('phpws_key');
     $db->addJoin('left', 'phpws_key', 'modules', 'module', 'title');
     $db->addWhere('active', 1);
     $db->addWhere('restricted', 0);
     if ($exclude) {
         foreach ($exclude as $module) {
             $db->addWhere('module', $module, '!=');
         }
     }
     $db->addOrder('update_date desc');
     $db->setLimit(PHPWS_Settings::get('whatsnew', 'qty_items'));
     $db->setIndexBy('id');
     $db->addColumn('phpws_key.url');
     $db->addColumn('phpws_key.title');
     $db->addColumn('phpws_key.summary');
     $db->addColumn('phpws_key.update_date');
     $db->addColumn('modules.title', null, 'module_title');
     $db->addColumn('modules.proper_name');
     //        $db->setTestMode();
     $result = $db->select();
     $tpl['TITLE'] = PHPWS_Text::parseOutput(PHPWS_Settings::get('whatsnew', 'title'));
     $tpl['TEXT'] = PHPWS_Text::parseOutput(PHPWS_Settings::get('whatsnew', 'text'));
     if (!PHPWS_Error::logIfError($result) && !empty($result)) {
         foreach ($result as $item) {
             $link = '<a href="' . $item['url'] . '">' . $item['title'] . '</a>';
             if (PHPWS_Settings::get('whatsnew', 'show_summaries')) {
                 $summary = PHPWS_Text::parseOutput($item['summary']);
             }
             if (PHPWS_Settings::get('whatsnew', 'show_dates')) {
                 $date = strftime(WHATSNEW_DATE_FORMAT, $item['update_date']);
             }
             if (PHPWS_Settings::get('whatsnew', 'show_source_modules')) {
                 $module_name = dgettext($item['module_title'], PHPWS_Text::parseOutput($item['proper_name']));
             }
             $tpl['new-items'][] = array('LINK' => $link, 'SUMMARY' => $summary, 'DATE' => $date, 'MODULE_NAME' => $module_name);
         }
     } else {
         $tpl['new-items'][] = array('LINK' => dgettext('whatsnew', 'Sorry, no results'));
     }
     $content = PHPWS_Template::process($tpl, 'whatsnew', 'block.tpl');
     if (PHPWS_Settings::get('whatsnew', 'cache_timeout') > 0 && !Current_User::isLogged() && !Current_User::allow('whatsnew')) {
         PHPWS_Cache::save($cache_key, $content);
     }
     return $content;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:59,代码来源:Whatsnew.php

示例8: lightbox

 public function lightbox()
 {
     javascript('lightbox');
     $message = null;
     PHPWS_Core::initModClass('filecabinet', 'Image.php');
     $folder = new Folder($this->file_id);
     if (!$folder->public_folder) {
         if (!Current_User::allow('filecabinet')) {
             return null;
         } else {
             $message = dgettext('filecabinet', 'Folder is private. Slideshow not available');
         }
     }
     $db = new PHPWS_DB('images');
     $db->addWhere('folder_id', $this->file_id);
     if ($this->num_visible < 99) {
         $db->addOrder('rand');
         $db->setLimit($this->num_visible);
     }
     $result = $db->getObjects('PHPWS_Image');
     if (PHPWS_Error::logIfError($result) || !$result) {
         return dgettext('filecabinet', 'Folder missing image files.');
     } else {
         foreach ($result as $image) {
             $img = sprintf('<a title="%s" href="%s">%s</a>', $image->getTitle(), $image->getPath(), $image->getThumbnail());
             $tpl['thumbnails'][] = array('IMAGE' => $img);
         }
         if ($this->vertical) {
             $tpl_file = 'lightbox_vert.tpl';
         } else {
             $tpl_file = 'lightbox_horz.tpl';
         }
         if ($message) {
             $tpl['MESSAGE'] = $message;
         }
         return PHPWS_Template::process($tpl, 'filecabinet', $tpl_file);
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:38,代码来源:File_Assoc.php

示例9: isEnabledForStudent

 public static function isEnabledForStudent(ApplicationFeatureRegistration $feature, $term, Student $student)
 {
     $db = new PHPWS_DB('hms_application_feature');
     $db->addWhere('name', $feature->getName());
     $db->addWhere('term', $term);
     $db->setLimit(1);
     $result = $db->select('row');
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
     if (empty($result) || is_null($result)) {
         return false;
     }
     if (!$feature->showForStudent($student, $term)) {
         return false;
     }
     if ($result['enabled'] == 0) {
         return false;
     }
     if (!is_null($result['start_date']) && time() < $result['start_date']) {
         return false;
     }
     if (!is_null($result['end_date']) && time() > $result['end_date']) {
         return false;
     }
     return true;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:27,代码来源:ApplicationFeature.php

示例10: newProperties

 public function newProperties()
 {
     \PHPWS_Core::initModClass('properties', 'Property.php');
     $db = new \PHPWS_DB('properties');
     $db->addOrder('created desc');
     $db->setLimit('5');
     $properties = $db->getObjects('Properties\\Property');
     if (empty($properties)) {
         return null;
     }
     foreach ($properties as $prop) {
         $new_properties[] = array('NAME' => $prop->getViewLink());
     }
     return $new_properties;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:15,代码来源:User.php

示例11: getEntries

 public static function getEntries(PHPWS_DB $db, $limit, $offset = 0)
 {
     $db->resetColumns();
     $db->setLimit($limit, $offset);
     $db->addOrder('sticky desc');
     $db->addOrder('publish_date desc');
     $db->loadClass('blog', 'Blog.php');
     return $db->getObjects('Blog');
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:9,代码来源:Blog_User.php

示例12: delete

 public function delete()
 {
     $db = new \PHPWS_DB('prop_photo');
     $db->addWhere('id', $this->id);
     $result = $db->delete();
     if (\PHPWS_Error::isError($result)) {
         \PHPWS_Error::log($result);
         return;
     }
     @unlink($this->path);
     @unlink(Photo::thumbnailPath($this->path));
     // if deleted pick is main pic, add new main
     if ($this->main_pic) {
         $db->reset();
         $db->addWhere('pid', $this->pid);
         $db->addValue('main_pic', 1);
         $db->setLimit(1);
         $db->update();
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:20,代码来源:Photo.php


注:本文中的PHPWS_DB::setLimit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。