當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。