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


PHP Section::syncroniseStatistics方法代码示例

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


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

示例1: buildDataXML

 public function buildDataXML($data)
 {
     $sections = new SectionIterator();
     $sections_xml = $this->document->createElement('sections');
     foreach ($sections as $s) {
         $section = $this->document->createElement('section');
         $entry_count = 0;
         $result = Symphony::Database()->query("\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\tcount(*) AS `count`\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t`tbl_entries` AS e\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\te.section = '%s'\n\t\t\t\t\t", array($s->handle));
         if ($result->valid()) {
             $entry_count = (int) $result->current()->count;
         }
         $section->setAttribute('entries', $entry_count);
         $name = $this->document->createElement('name', $s->name);
         $name->setAttribute('handle', $s->handle);
         $section->appendChild($name);
         $section->appendChild($this->document->createElement('navigation-group', $s->{'navigation-group'}));
         $section->appendChild($this->document->createElement('status', Section::syncroniseStatistics($s)->synced ? 'Synced' : 'Not Synced'));
         $sections_xml->appendChild($section);
     }
     $data->appendChild($sections_xml);
 }
开发者ID:symphonycms,项目名称:symphony-3,代码行数:21,代码来源:sections.driver.php

示例2: appendSyncAlert

 protected function appendSyncAlert()
 {
     $sync = Section::syncroniseStatistics($this->section);
     if ($sync->synced === true) {
         return;
     }
     $table_fields = array();
     $table_actions = array();
     $table_totals = array();
     $table = $this->createElement('table');
     $table->setAttribute('class', 'sync-table');
     // Find all fields:
     foreach ($sync as $name => $action) {
         if (is_array($action)) {
             $table_actions[$name] = count($action);
             foreach ($action as $guid => $data) {
                 $table_fields[$guid] = $data;
             }
         }
     }
     // Sort actions:
     uksort($table_actions, array($this, '__sortActions'));
     // Sort fields:
     uasort($table_fields, array($this, '__sortFields'));
     // Header:
     $row = $this->createElement('tr');
     $row->appendChild($this->createElement('th', __('Name')));
     foreach ($table_actions as $action => $count) {
         $row->appendChild($this->createElement('th', __(ucwords($action))));
     }
     $table->appendChild($row);
     $row = $this->createElement('tr');
     $cell = $this->createElement('th');
     if ($sync->section->rename) {
         $cell->appendChild($this->createTextNode($sync->section->new->name . ' '));
         $span = $this->createElement('span');
         $span->setAttribute('class', 'old');
         $span->appendChild($this->createEntityReference('larr'));
         $span->appendChild($this->createTextNode(' ' . $sync->section->old->name));
         $cell->appendChild($span);
         $row->appendChild($cell);
         foreach ($table_actions as $action => $count) {
             $cell = $this->createElement('td', __('No'));
             $cell->setAttribute('class', 'no');
             if ($action == 'rename') {
                 $cell->setValue(__('Yes'));
                 $cell->setAttribute('class', 'yes');
             }
             $row->appendChild($cell);
         }
     } else {
         $cell->setValue($sync->section->new->name);
         $row->appendChild($cell);
         foreach ($table_actions as $action => $count) {
             $cell = $this->createElement('td', __('No'));
             $cell->setAttribute('class', 'no');
             if ($action == 'create' and $sync->section->create) {
                 $cell->setValue(__('Yes'));
                 $cell->setAttribute('class', 'yes');
             }
             if ($action == 'update' and !$sync->section->create) {
                 $cell->setValue(__('Yes'));
                 $cell->setAttribute('class', 'yes');
             }
             $row->appendChild($cell);
         }
     }
     $table->appendChild($row);
     // Body:
     foreach ($table_fields as $guid => $data) {
         $row = $this->createElement('tr');
         $cell = $this->createElement('th');
         if (isset($sync->rename[$guid])) {
             $cell->appendChild($this->createTextNode($data->new->{'publish-label'} . ' '));
             $span = $this->createElement('span');
             $span->setAttribute('class', 'old');
             $span->appendChild($this->createEntityReference('larr'));
             $span->appendChild($this->createTextNode(' ' . $data->old->{'publish-label'}));
             $cell->appendChild($span);
         } else {
             $cell->setValue($data->{'publish-label'});
         }
         $row->appendChild($cell);
         foreach ($table_actions as $action => $count) {
             $cell = $this->createElement('td', __('No'));
             $cell->setAttribute('class', 'no');
             if (array_key_exists($guid, $sync->{$action})) {
                 $cell->setValue(__('Yes'));
                 $cell->setAttribute('class', 'yes');
             }
             $row->appendChild($cell);
         }
         $table->appendChild($row);
     }
     $div = $this->createElement('div');
     $div->setAttribute('class', 'actions');
     $div->appendChild(Widget::Submit('action[sync]', __('Apply Changes')));
     $wrapper = $this->createElement('div');
     $wrapper->appendChild($table);
     $wrapper->appendChild($this->createElement('p', __('These changes will be applied to your database when you save this section.')));
//.........这里部分代码省略.........
开发者ID:brendo,项目名称:symphony-3,代码行数:101,代码来源:content.blueprintssections.php


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