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


PHP Section::get方法代码示例

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


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

示例1: printS

function printS($id)
{
    $ci =& get_instance();
    $s = new Section();
    $s->get_by_id($id);
    $s->e = anchor($ci->app->app_url('edit/') . $s->id, 'Edit');
    $s->d = anchor($ci->app->app_url('delete/') . $s->id, 'Delete');
    $output = "<li>";
    $output .= $s->id . '|';
    $output .= $s->name;
    $output .= add($id, 0, "add first child for {$s->name}");
    $output .= '|';
    $output .= $s->e;
    $output .= '|';
    $output .= $s->d;
    $c = new Section();
    $c->where('parent_section', $id);
    $c->order_by('sort', 'asc');
    $c->get();
    if (count($c->all) > 0) {
        $output .= "<ul>";
        foreach ($c->all as $item) {
            $output .= printS($item->id);
            $output .= "<li>" . add($id, $item->sort + 1) . "</li>";
        }
        $output .= "</ul>";
    }
    $output .= "</li>";
    return $output;
}
开发者ID:blumine,项目名称:vunsy,代码行数:30,代码来源:view.php

示例2: findEntries

 public static function findEntries($entries, Section $section)
 {
     $entries = explode(',', $entries);
     $ret = EntryManager::fetch($entries, $section->get('id'));
     if ($ret === false) {
         self::throwEx('An error occurred while processing entries');
     }
     return $ret;
 }
开发者ID:alpacaaa,项目名称:image_info,代码行数:9,代码来源:class.images_info.php

示例3: Section

 function get_section()
 {
     $CI =& get_instance();
     if ($this->installed()) {
         if (!isset($CI->uri)) {
             $CI->load->library('URI');
         }
         $sec = new Section();
         $sec->get_by_id($CI->uri->segment(1));
         if (!$sec->exists()) {
             $sec->get();
         }
         return $sec;
     }
 }
开发者ID:blumine,项目名称:vunsy,代码行数:15,代码来源:Vunsy.php

示例4: onAfterWrite

 public function onAfterWrite()
 {
     parent::onAfterWrite();
     if ($this->owner->Sections()->Count() == 0) {
         $section = Section::get()->filter(array('ClassName' => 'MainSection'))->first();
         if ($section) {
             $this->owner->Sections()->add($section->ID);
         } else {
             $section = MainSection::create();
             $section->AdminTitle = 'Placeholder for main content';
             $section->Public = true;
             $section->Write();
             $this->owner->Sections()->add($section);
         }
     }
 }
开发者ID:helpfulrobot,项目名称:coreiho-silverstripe-sections,代码行数:16,代码来源:SectionPageExtension.php

示例5: delete

 /**
  * delete that section with all it's subsections
  * plus eliminate the gap between it's siblings sort
  **/
 public function delete($object = '', $related_field = '')
 {
     if (empty($object)) {
         // update all the sections sort after that section
         // that in the same parent section
         $s = new Section();
         $s->where('sort >', $this->sort);
         $s->where('parent_section', $this->parent_section);
         $s->get();
         foreach ($s as $item) {
             $item->sort--;
             $item->save();
         }
     }
     //delete this section
     parent::delete($object, $related_field);
 }
开发者ID:kabircse,项目名称:Codeigniter-Egypt,代码行数:21,代码来源:section.php

示例6: dAdminPagePreGenerate

 public function dAdminPagePreGenerate($context)
 {
     if (!$this->_enabled) {
         return false;
     }
     $callback = Administration::instance()->getPageCallback();
     // index page
     if ($callback['context']['page'] === 'index') {
         /* Create button */
         if ($this->_max > 0 && $this->_total >= $this->_max) {
             $context['oPage']->Context->getChild(1)->removeChildAt(0);
         }
         /* Feedback message */
         $msg_total_entries = $this->_total === 1 ? __('There is %d entry', array($this->_total)) : __('There are %d entries', array($this->_total));
         $msg_max_entries = '';
         $msg_create_more = '';
         if ($this->_max !== 0) {
             $msg_max_entries = __(' out of a maximum of ') . $this->_max;
             if ($this->_total >= $this->_max) {
                 $msg_create_more = __("You can't create more entries.");
             } else {
                 $diff = $this->_max - $this->_total;
                 $msg_create_more = __("You can create %d more", array($diff));
                 $msg_create_more .= ' ' . ($diff === 1 ? __('entry') : __('entries')) . '.';
             }
         }
         $feedback = $msg_total_entries . $msg_max_entries . '. ' . $msg_create_more;
         $context['oPage']->Contents->prependChild(new XMLElement('p', $feedback, array('style' => 'margin: 10px 0 0 18px;')));
     } elseif (in_array($callback['context']['page'], array('new', 'edit'))) {
         // replace breadcrumbs (emulate static section)
         if ($this->_max === 1) {
             $breadcrumbs = $context['oPage']->Context->getChild(0);
             $children_count = $breadcrumbs->getNumberOfChildren();
             for ($i = $children_count - 1; $i >= 0; $i--) {
                 $breadcrumbs->removeChildAt($i);
             }
             $breadcrumbs->appendChild(new XMLElement('h2', $this->_section->get('name')));
         }
     }
 }
开发者ID:rc1,项目名称:WebAppsWithCmsStartHere,代码行数:40,代码来源:extension.driver.php

示例7: prepareAssociationsDrawer

 /**
  * Prepare a Drawer to visualize section associations
  *
  * @param  Section $section The current Section object
  * @throws InvalidArgumentException
  * @throws Exception
  */
 private function prepareAssociationsDrawer($section)
 {
     $entry_id = !is_null($this->_context['entry_id']) ? $this->_context['entry_id'] : null;
     $show_entries = Symphony::Configuration()->get('association_maximum_rows', 'symphony');
     if (is_null($entry_id) && !isset($_GET['prepopulate']) || is_null($show_entries) || $show_entries == 0) {
         return;
     }
     $parent_associations = SectionManager::fetchParentAssociations($section->get('id'), true);
     $child_associations = SectionManager::fetchChildAssociations($section->get('id'), true);
     $content = null;
     $drawer_position = 'vertical-right';
     /**
      * Prepare Associations Drawer from an Extension
      *
      * @since Symphony 2.3.3
      * @delegate PrepareAssociationsDrawer
      * @param string $context
      * '/publish/'
      * @param integer $entry_id
      *  The entry ID or null
      * @param array $parent_associations
      *  Array of Sections
      * @param array $child_associations
      *  Array of Sections
      * @param string $drawer_position
      *  The position of the Drawer, defaults to `vertical-right`. Available
      *  values of `vertical-left, `vertical-right` and `horizontal`
      */
     Symphony::ExtensionManager()->notifyMembers('PrepareAssociationsDrawer', '/publish/', array('entry_id' => $entry_id, 'parent_associations' => &$parent_associations, 'child_associations' => &$child_associations, 'content' => &$content, 'drawer-position' => &$drawer_position));
     // If there are no associations, return now.
     if ((is_null($parent_associations) || empty($parent_associations)) && (is_null($child_associations) || empty($child_associations))) {
         return;
     }
     if (!$content instanceof XMLElement) {
         $content = new XMLElement('div', null, array('class' => 'content'));
         $content->setSelfClosingTag(false);
         // Process Parent Associations
         if (!is_null($parent_associations) && !empty($parent_associations)) {
             foreach ($parent_associations as $as) {
                 if ($field = FieldManager::fetch($as['parent_section_field_id'])) {
                     if (isset($_GET['prepopulate'])) {
                         $prepopulate_field = key($_GET['prepopulate']);
                     }
                     // get associated entries if entry exists,
                     if ($entry_id) {
                         $entry_ids = $field->findParentRelatedEntries($as['child_section_field_id'], $entry_id);
                         // get prepopulated entry otherwise
                     } elseif (isset($_GET['prepopulate'])) {
                         $entry_ids = array(intval(current($_GET['prepopulate'])));
                     } else {
                         $entry_ids = array();
                     }
                     // Use $schema for perf reasons
                     $schema = array($field->get('element_name'));
                     $where = !empty($entry_ids) ? sprintf(' AND `e`.`id` IN (%s)', implode(', ', $entry_ids)) : null;
                     $entries = !empty($entry_ids) || isset($_GET['prepopulate']) && $field->get('id') === $prepopulate_field ? EntryManager::fetchByPage(1, $as['parent_section_id'], $show_entries, $where, null, false, false, true, $schema) : array();
                     $has_entries = !empty($entries) && $entries['total-entries'] != 0;
                     if ($has_entries) {
                         $element = new XMLElement('section', null, array('class' => 'association parent'));
                         $header = new XMLElement('header');
                         $header->appendChild(new XMLElement('p', __('Linked to %s in', array('<a class="association-section" href="' . SYMPHONY_URL . '/publish/' . $as['handle'] . '/">' . $as['name'] . '</a>'))));
                         $element->appendChild($header);
                         $ul = new XMLElement('ul', null, array('class' => 'association-links', 'data-section-id' => $as['child_section_id'], 'data-association-ids' => implode(', ', $entry_ids)));
                         foreach ($entries['records'] as $e) {
                             // let the field create the mark up
                             $li = $field->prepareAssociationsDrawerXMLElement($e, $as);
                             // add it to the unordered list
                             $ul->appendChild($li);
                         }
                         $element->appendChild($ul);
                         $content->appendChild($element);
                     }
                 }
             }
         }
         // Process Child Associations
         if (!is_null($child_associations) && !empty($child_associations)) {
             foreach ($child_associations as $as) {
                 // Get the related section
                 $child_section = SectionManager::fetch($as['child_section_id']);
                 if (!$child_section instanceof Section) {
                     continue;
                 }
                 // Get the visible field instance (using the sorting field, this is more flexible than visibleColumns())
                 // Get the link field instance
                 $visible_field = current($child_section->fetchVisibleColumns());
                 $relation_field = FieldManager::fetch($as['child_section_field_id']);
                 // Get entries, using $schema for performance reasons.
                 $entry_ids = $relation_field->findRelatedEntries($entry_id, $as['parent_section_field_id']);
                 $schema = $visible_field ? array($visible_field->get('element_name')) : array();
                 $where = sprintf(' AND `e`.`id` IN (%s)', implode(', ', $entry_ids));
                 $entries = !empty($entry_ids) ? EntryManager::fetchByPage(1, $as['child_section_id'], $show_entries, $where, null, false, false, true, $schema) : array();
                 $has_entries = !empty($entries) && $entries['total-entries'] != 0;
//.........这里部分代码省略.........
开发者ID:rc1,项目名称:WebAppsWithCmsStartHere,代码行数:101,代码来源:content.publish.php

示例8: processSendMailFilter

 /**
  * This function handles the Send Mail filter which will send an email
  * to each specified recipient informing them that an Entry has been
  * created.
  *
  * @param XMLElement $result
  *  The XMLElement of the XML that is going to be returned as part
  *  of this event to the page.
  * @param array $send_mail
  *  Associative array of `send-mail` parameters.
  * @param array $fields
  *  Array of post data to extract the values from
  * @param Section $section
  *  This Section for this event
  * @param Section $section
  *  This current Entry that has just been updated or created
  * @return XMLElement
  *  The modified `$result` with the results of the filter.
  */
 public function processSendMailFilter(XMLElement $result, array $send_email, array &$fields, Section $section, Entry $entry)
 {
     $fields['recipient'] = self::replaceFieldToken($send_email['recipient'], $fields);
     $fields['recipient'] = preg_split('/\\,/i', $fields['recipient'], -1, PREG_SPLIT_NO_EMPTY);
     $fields['recipient'] = array_map('trim', $fields['recipient']);
     $fields['subject'] = self::replaceFieldToken($send_email['subject'], $fields, __('[Symphony] A new entry was created on %s', array(Symphony::Configuration()->get('sitename', 'general'))));
     $fields['body'] = self::replaceFieldToken($send_email['body'], $fields, null, false, false);
     $fields['sender-email'] = self::replaceFieldToken($send_email['sender-email'], $fields);
     $fields['sender-name'] = self::replaceFieldToken($send_email['sender-name'], $fields);
     $fields['reply-to-name'] = self::replaceFieldToken($send_email['reply-to-name'], $fields);
     $fields['reply-to-email'] = self::replaceFieldToken($send_email['reply-to-email'], $fields);
     $edit_link = SYMPHONY_URL . '/publish/' . $section->get('handle') . '/edit/' . $entry->get('id') . '/';
     $language = Symphony::Configuration()->get('lang', 'symphony');
     $template_path = Event::getNotificationTemplate($language);
     $body = sprintf(file_get_contents($template_path), $section->get('name'), $edit_link);
     if (is_array($fields['body'])) {
         foreach ($fields['body'] as $field_handle => $value) {
             $body .= "// {$field_handle}" . PHP_EOL . $value . PHP_EOL . PHP_EOL;
         }
     } else {
         $body .= $fields['body'];
     }
     // Loop over all the recipients and attempt to send them an email
     // Errors will be appended to the Event XML
     $errors = array();
     foreach ($fields['recipient'] as $recipient) {
         $author = AuthorManager::fetchByUsername($recipient);
         if (empty($author)) {
             $errors['recipient'][$recipient] = __('Recipient not found');
             continue;
         }
         $email = Email::create();
         // Huib: Exceptions are also thrown in the settings functions, not only in the send function.
         // Those Exceptions should be caught too.
         try {
             $email->recipients = array($author->get('first_name') => $author->get('email'));
             if ($fields['sender-name'] != null) {
                 $email->sender_name = $fields['sender-name'];
             }
             if ($fields['sender-email'] != null) {
                 $email->sender_email_address = $fields['sender-email'];
             }
             if ($fields['reply-to-name'] != null) {
                 $email->reply_to_name = $fields['reply-to-name'];
             }
             if ($fields['reply-to-email'] != null) {
                 $email->reply_to_email_address = $fields['reply-to-email'];
             }
             $email->text_plain = str_replace('<!-- RECIPIENT NAME -->', $author->get('first_name'), $body);
             $email->subject = $fields['subject'];
             $email->send();
         } catch (EmailValidationException $e) {
             $errors['address'][$author->get('email')] = $e->getMessage();
         } catch (EmailGatewayException $e) {
             $errors['gateway'][$author->get('email')] = $e->getMessage();
         } catch (EmailException $e) {
             $errors['email'][$author->get('email')] = $e->getMessage();
         }
     }
     // If there were errors, output them to the event
     if (!empty($errors)) {
         $xml = self::buildFilterElement('send-email', 'failed');
         foreach ($errors as $type => $messages) {
             $xType = new XMLElement('error');
             $xType->setAttribute('error-type', $type);
             foreach ($messages as $recipient => $message) {
                 $xType->appendChild(new XMLElement('message', $message, array('recipient' => $recipient)));
             }
             $xml->appendChild($xType);
         }
         $result->appendChild($xml);
     } else {
         $result->appendChild(self::buildFilterElement('send-email', 'passed'));
     }
     return $result;
 }
开发者ID:nils-werner,项目名称:symphony-2,代码行数:95,代码来源:class.event.section.php

示例9: processResults

 public function processResults(SymRead $query, Section $section, array $pagination, array $entries)
 {
     $this->data = array('section' => array('id' => (int) $section->get('id'), 'handle' => $section->get('handle'), 'name' => $section->get('name')), 'pagination' => $pagination, 'entries' => array());
     foreach ($entries as $entry) {
         $entry_id = (int) $entry->get('id');
         $entry_date = strtotime($entry->creationDate);
         $entry_array = array();
         foreach ($query->selects as $select) {
             $field = $select->get('object');
             if ($field == SymQuery::SYSTEM_ID) {
                 $entry_array[SymQuery::SYSTEM_ID] = $entry_id;
             }
             if ($field == SymQuery::SYSTEM_DATE) {
                 $entry_array[SymQuery::SYSTEM_DATE] = array('value' => DateTimeObj::get('c', $entry_date), 'local' => strtotime(DateTimeObj::get('c', $entry_date)), 'gmt' => strtotime(DateTimeObj::getGMT('c', $entry_date)));
             } else {
                 if ($field instanceof Field) {
                     $field_id = (int) $field->get('id');
                     $field_handle = $field->get('element_name');
                     $entry_array[$field_handle] = $entry->getData($field_id);
                 }
             }
         }
         $this->data['entries'][] = $entry_array;
     }
     return $this;
 }
开发者ID:brendo,项目名称:symquery,代码行数:26,代码来源:class.symread.php

示例10: Section

 function deattach_section($section = '')
 {
     //=========================
     //normalize the  sort numbers
     //=========================
     $cont = new Section();
     // we have to push all the content up to fill that hole
     // these content must me in the same section,parent,cell
     // and have sort nubmer greater than that content
     $cont->where('parent_section', $section->parent_section);
     //same section
     $cont->where('sort >', $section->sort);
     //greater sort
     $cont->get();
     //get them to process
     foreach ($cont->all as $item) {
         $item->sort--;
         $item->save();
     }
 }
开发者ID:sigit,项目名称:vunsy,代码行数:20,代码来源:section.php

示例11: menu

 /**
  * Generate the top-level menu for the sections of your app.
  *
  * @param string|bool $current
  *
  * @return string
  */
 public static function menu($current = false)
 {
     if (!\User::require_login()) {
         return '';
     }
     $customer = self::customer();
     if (!$customer) {
         return '';
     }
     $conf = self::$conf;
     if (!is_array($conf['Sections'])) {
         $conf['Sections'] = array();
     }
     if (!$current) {
         $current = Section::get();
     }
     $out = '<ul class="nav">';
     foreach ($conf['Sections'] as $key => $value) {
         if (strpos($key, 'dropdown:') === 0) {
             // handle dropdown menu options
             $key = str_replace('dropdown:', '', $key);
             $label = array_shift($value);
             $out .= '<li class="dropdown">' . '<a href="#" class="dropdown-toggle" data-toggle="dropdown">' . $label . ' <b class="caret"></b></a>' . '<ul class="dropdown-menu">';
             foreach ($value as $handler => $label) {
                 $out .= sprintf('<li><a href="%s">%s</a></li>', self::make_href($handler), $label);
             }
             $out .= '</ul></li>';
             continue;
         }
         // handle regular menu options
         $class = $current && $current === $key ? ' class="active"' : '';
         $out .= sprintf('<li%s><a href="%s/%s">%s</a></li>', $class, self::href(), $key, array_shift($value));
     }
     // Add account
     $class = strpos($_SERVER['REQUEST_URI'], '/saasy/account') === 0 ? ' class="active"' : '';
     $out .= sprintf('<li%s><a href="%s/%s">%s</a></li>', $class, self::href(), 'account', __('Account'));
     // Add sign out
     $out .= sprintf('<li><a href="/user/logout">%s</a></li>', __('Sign Out'));
     return $out . '</ul>';
 }
开发者ID:irismeijer,项目名称:test,代码行数:47,代码来源:App.php

示例12: app_path

|--------------------------------------------------------------------------
| Maintenance Mode Handler
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application
| into maintenance mode. Here, you will define what is displayed back
| to the user if maintenance mode is in effect for the application.
|
*/
App::down(function () {
    return Response::view('page.system.maintenance', ['sections' => []], 503);
});
App::missing(function (Exception $exception) {
    if (Request::is('*/.json')) {
        return Response::json(['error' => 'not found'], 404);
    }
    $section = new Section();
    return View::make('page.system.404', ['message' => $exception->getMessage(), 'sections' => $section->get()]);
});
/*
|--------------------------------------------------------------------------
| Require The Filters File
|--------------------------------------------------------------------------
|
| Next we will load the filters file for the application. This gives us
| a nice separate location to store our route and application filter
| definitions instead of putting them all in the main routes file.
|
*/
require app_path() . '/filters.php';
require app_path() . '/validators.php';
开发者ID:hrenos,项目名称:spreadit,代码行数:31,代码来源:global.php

示例13: getSection

 public static function getSection()
 {
     $s = Section::get();
     self::$section = $s;
     return new self();
 }
开发者ID:awidarto,项目名称:tmadminflat,代码行数:6,代码来源:Prefs.php


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