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


PHP dmDb::query方法代码示例

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


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

示例1: getFirstMedia

 public function getFirstMedia()
 {
     if ($this->_invoker->contains($this->_options['mediaAlias'])) {
         return $this->_invoker->reference($this->_options['mediaAlias'])->getFirst();
     }
     return dmDb::query('DmMedia m, m.Folder f, m.' . $this->getGalleryRelClass() . ' rel')->where('rel.dm_record_id = ?', $this->_invoker->get('id'))->orderBy('rel.position ASC')->select('m.*, f.*')->fetchOne();
 }
开发者ID:Regmaya,项目名称:diem,代码行数:7,代码来源:DmGallery.php

示例2: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     throw new dmException('deprecated');
     $this->withDatabase();
     $page = dmDb::table('DmPage')->findOneByIdWithI18n($arguments['id'], $arguments['culture']);
     if (!$page instanceof DmPage) {
         throw new dmException('No page with id = ' . $arguments['id']);
     }
     $this->getContext()->setPage($page);
     $area = dmDb::query('DmArea a, a.Zones z, z.Widgets w')->select('a.id, z.id, w.module, w.action, w.value')->where('a.type = ? AND a.dm_page_view_id = ?', array('content', $page->get('PageView')->get('id')))->orderBy('z.position asc, w.position asc')->fetchArray();
     $widgetTypeManager = $dmContext->get('widget_type_manager');
     $html = '';
     foreach ($area[0]['Zones'] as $zone) {
         foreach ($zone['Widgets'] as $widget) {
             if (!in_array($widget['module'] . '.' . $widget['action'], self::$skipWidgets)) {
                 $widget['css_class'] = null;
                 $widgetViewClass = $widgetTypeManager->getWidgetType($widget['module'], $widget['action'])->getViewClass();
                 $widgetView = new $widgetViewClass($widget);
                 try {
                     $html .= $widgetView->toIndexableString();
                 } catch (Exception $e) {
                     $this->log($e->getMessage());
                 }
             }
         }
     }
     $indexableText = dmSearchIndex::cleanText($html);
     die($indexableText);
 }
开发者ID:theolymp,项目名称:diem,代码行数:32,代码来源:dmFrontPageIndexableContentTask.class.php

示例3: updateDatabase

 /**
  * Update changed documentation pages in database
  */
 protected function updateDatabase($branch)
 {
     $types = dmDb::query('Doc d')->select('d.type')->distinct()->fetchFlat();
     $cultures = sfConfig::get('dm_i18n_cultures');
     $originalCulture = sfDoctrineRecord::getDefaultCulture();
     foreach ($types as $type) {
         foreach ($cultures as $culture) {
             sfDoctrineRecord::setDefaultCulture($culture);
             $dir = dmOs::join($this->repo->getDir(), $type, $culture);
             $files = sfFinder::type('file')->name('/^\\d{2}\\s-\\s.+\\.markdown$/')->in($dir);
             foreach ($files as $file) {
                 $docName = preg_replace('/^\\d{2}\\s-\\s(.+)\\.markdown$/', '$1', basename($file));
                 $docRecord = dmDb::query('DocPage dp')->withI18n()->innerJoin('dp.Doc doc')->innerJoin('doc.Branch branch')->where('branch.number = ?', $branch)->andWhere('doc.type = ?', $type)->andWhere('dpTranslation.name = ?', $docName)->fetchOne();
                 if ($docRecord) {
                     $docText = file_get_contents($file);
                     if ($docRecord->text != $docText) {
                         $docRecord->text = $docText;
                         $docRecord->save();
                     }
                 }
             }
         }
     }
     sfDoctrineRecord::setDefaultCulture($originalCulture);
 }
开发者ID:Regmaya,项目名称:diem-project,代码行数:28,代码来源:gitDocumentationSynchronizer.php

示例4: generateLayoutTemplates

 protected function generateLayoutTemplates()
 {
     $this->logSection('diem', 'generate layout templates');
     $filesystem = $this->get('filesystem');
     foreach (dmDb::query('DmLayout l')->fetchRecords() as $layout) {
         $template = $layout->get('template');
         $templateFile = dmProject::rootify('apps/front/modules/dmFront/templates/' . $template . 'Success.php');
         if (!file_exists($templateFile)) {
             if ($filesystem->mkdir(dirname($templateFile))) {
                 $filesystem->copy(dmOs::join(sfConfig::get('dm_front_dir'), 'modules/dmFront/templates/pageSuccess.php'), $templateFile);
                 $filesystem->chmod($templateFile, 0777);
             } else {
                 $this->logBlock('Can NOT create layout template ' . $template, 'ERROR');
             }
         }
     }
     $layoutFile = dmProject::rootify('apps/front/modules/dmFront/templates/layout.php');
     if (!file_exists($layoutFile)) {
         if ($filesystem->mkdir(dirname($layoutFile))) {
             $filesystem->copy(dmOs::join(sfConfig::get('dm_front_dir'), 'modules/dmFront/templates/layout.php'), $layoutFile);
             $filesystem->chmod($layoutFile, 0777);
         } else {
             $this->logBlock('Can NOT create layout ' . $layoutFile, 'ERROR');
         }
     }
 }
开发者ID:theolymp,项目名称:diem,代码行数:26,代码来源:dmFrontGenerateTask.class.php

示例5: getGroupNames

 public function getGroupNames()
 {
     $groups = dmDb::query('DmSetting s')->select('s.group_name')->groupBy('s.group_name')->fetchPDO();
     foreach ($groups as $index => $group) {
         $groups[$index] = $group[0];
     }
     return $groups;
 }
开发者ID:theolymp,项目名称:diem,代码行数:8,代码来源:PluginDmSettingTable.class.php

示例6: executeTest

 public function executeTest()
 {
     $widget = dmDb::query('DmWidget q')->withI18n()->where('q.id = ?', 272)->fetchOne();
     $widgetValue = $widget->value;
     $widget = $widget->toArray();
     $widget['value'] = $widgetValue;
     $this->html = $this->getService('page_helper')->renderWidget($widget);
 }
开发者ID:Regmaya,项目名称:diem-project,代码行数:8,代码来源:components.class.php

示例7: getUser

 public function getUser()
 {
     $userId = $this->get('user_id');
     if (!isset(self::$usersCache[$userId])) {
         self::$usersCache[$userId] = $userId ? dmDb::query('DmUser u')->where('u.id = ?', $userId)->fetchRecord() : null;
     }
     return self::$usersCache[$userId];
 }
开发者ID:jdart,项目名称:diem,代码行数:8,代码来源:dmRequestLogEntry.php

示例8: executeShow

 public function executeShow()
 {
     $query = $this->getShowQuery('b');
     $this->branch = $this->getRecord($query);
     $this->tuto = dmDb::query('DocPage p')->withI18n()->leftJoin('p.Doc d')->where('d.type = ?', 'tuto')->orderBy('p.position ASC')->fetchOne();
     $this->howTo = dmDb::query('Doc d')->withI18n()->where('d.type = ?', 'howto')->fetchOne();
     $this->openSourceProjects = dmDb::query('DocPage p')->withI18n()->where('pTranslation.name = ?', 'Open source projects')->fetchOne();
 }
开发者ID:Regmaya,项目名称:diem-project,代码行数:8,代码来源:components.class.php

示例9: createAdminUser

 protected function createAdminUser()
 {
     dmDb::query('DmUser u')->delete()->where('u.username = ?', 'admin')->execute();
     $user = dmDb::table('DmUser')->create(array('username' => 'admin', 'email' => 'demo@nomail.org', 'is_active' => true, 'is_super_admin' => false));
     $user->setPassword('admin');
     $user->addGroupByName('demo');
     $user->save();
 }
开发者ID:Regmaya,项目名称:diem-project,代码行数:8,代码来源:demoPrepareTask.class.php

示例10: getNbPages

 /**
  * How many pages use this layout?
  */
 public function getNbPages()
 {
     $nb = 0;
     foreach ($this->get('PageViews') as $pageView) {
         $nb += dmDb::query('DmPage p')->where('p.module = ?', $pageView->module)->andWhere('p.action = ?', $pageView->action)->count();
     }
     return $nb;
 }
开发者ID:theolymp,项目名称:diem,代码行数:11,代码来源:PluginDmLayout.class.php

示例11: setTemplate

 /**
  * Set a template to the mail
  *
  * @param mixed $templateName the template name, or a DmMailTemplateInstance
  * @return dmMail $this
  */
 public function setTemplate($templateName)
 {
     if ($templateName instanceof DmMailTemplate) {
         $this->template = $templateName;
     } elseif (!($this->template = dmDb::query('DmMailTemplate t')->where('t.name = ?', $templateName)->fetchRecord())) {
         $this->template = dmDb::create('DmMailTemplate', array('name' => $templateName));
     }
     return $this;
 }
开发者ID:jdart,项目名称:diem,代码行数:15,代码来源:dmMail.php

示例12: getParentChoices

 protected function getParentChoices()
 {
     $_parentChoices = dmDb::query('DmMediaFolder f')->where('f.lft < ? OR f.rgt > ?', array($this->folder->lft, $this->folder->rgt))->orderBy('f.lft')->select('f.id, f.level, f.rel_path')->fetchPDO();
     $parentChoices = array();
     foreach ($_parentChoices as $values) {
         $name = basename($values[2]) ? basename($values[2]) : 'root';
         $parentChoices[$values[0]] = str_repeat('&nbsp;&nbsp;', $values[1]) . '-&nbsp;' . $name;
     }
     return $parentChoices;
 }
开发者ID:theolymp,项目名称:diem,代码行数:10,代码来源:DmAdminMoveMediaFolderForm.php

示例13: executeGetAttributes

 public function executeGetAttributes(sfWebRequest $request)
 {
     $bm = $this->getService('behaviors_manager');
     $user = $this->getService('user');
     $this->forward404Unless($zone = dmDb::query('DmZone z')->where('z.id = ?', $request->getParameter('zone_id'))->select('z.width as width, z.css_class as css_class')->limit(1)->fetchPDO());
     if ($bm->isZoneAttachable() && ($user->can('behavior_add') || $user->can('behavior_edit') || $user->can('behavior_delete') || $user->can('behavior_sort'))) {
         $zone[0][1] = $zone[0][1] . '.dm_behaviors_attachable';
     }
     return $this->renderJson($zone[0]);
 }
开发者ID:runopencode,项目名称:diem-extended,代码行数:10,代码来源:actions.class.php

示例14: getFolderChoices

 protected function getFolderChoices()
 {
     $_folderChoices = dmDb::query('DmMediaFolder f')->orderBy('f.lft')->select('f.id, f.level, f.rel_path')->fetchPDO();
     $folderChoices = array();
     foreach ($_folderChoices as $values) {
         $name = basename($values[2]) ? basename($values[2]) : 'root';
         $folderChoices[$values[0]] = str_repeat('&nbsp;&nbsp;', $values[1]) . '-&nbsp;' . $name;
     }
     return $folderChoices;
 }
开发者ID:theolymp,项目名称:diem,代码行数:10,代码来源:DmAdminMediaForm.php

示例15: executeMyAccount

 public function executeMyAccount()
 {
     if ($this->user = $this->getUser()->getDmUser()) {
         $this->plugins = dmDb::query('Plugin p')->where('p.created_by = ?', $this->user->id)->andWhere('p.is_active = ?', true)->orderByPosition()->fetchRecords();
         $this->preloadPages($this->plugins);
     } else {
         $this->form = $this->forms['DmSigninFront'] = new DmSigninFrontForm();
         unset($this->form['remember_me']);
     }
 }
开发者ID:Regmaya,项目名称:diem-project,代码行数:10,代码来源:components.class.php


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