本文整理汇总了PHP中Section::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Section::load方法的具体用法?PHP Section::load怎么用?PHP Section::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Section
的用法示例。
在下文中一共展示了Section::load方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remove
public static function remove($name)
{
$sectionManager = new Section();
$sectionManager->load(array('label' => $name));
$rightManager = new Right();
$rightManager->delete(array('section' => $sectionManager->getId()));
$sectionManager->delete(array('id' => $sectionManager->getId()));
}
示例2: __form
public function __form(Entry $existing = NULL)
{
$callback = Administration::instance()->getPageCallback();
$section = Section::load(sprintf('%s/%s.xml', SECTIONS, $callback['context']['section_handle']));
// Check that a layout and fields exist
if (isset($section->fields)) {
$this->alerts()->append(__('It looks like you\'re trying to create an entry. Perhaps you want fields first? <a href="%s">Click here to create some.</a>', array(ADMIN_URL . '/blueprints/sections/edit/' . $section->handle . '/')), AlertStack::ERROR);
}
$this->Form->setAttribute('enctype', 'multipart/form-data');
$this->setTitle(__('%1$s – %2$s', array(__('Symphony'), $section->name)));
$subheading = __('New Entry');
if (!is_null($existing) && $existing instanceof Entry) {
if (is_null($this->entry) || !$this->entry instanceof Entry) {
$this->entry = $existing;
}
// Grab the first field in the section
$first_field = $section->fields[0];
$field_data = (object) array();
if (!is_null($existing->data()->{$first_field->{'element-name'}})) {
$field_data = $existing->data()->{$first_field->{'element-name'}};
}
$subheading = $first_field->prepareTableValue($field_data);
}
if (is_null($this->entry) || !$this->entry instanceof Entry) {
$this->entry = new Entry();
}
$this->entry->section = $callback['context']['section_handle'];
$this->appendSubheading($subheading);
$this->entry->findDefaultFieldData();
$this->Form->appendChild(Widget::Input('MAX_FILE_SIZE', Symphony::Configuration()->core()->symphony->{'maximum-upload-size'}, 'hidden'));
// Check if there is a field to prepopulate
if (isset($_REQUEST['prepopulate']) && strlen(trim($_REQUEST['prepopulate'])) > 0) {
$field_handle = key($_REQUEST['prepopulate']);
$value = stripslashes(rawurldecode($_REQUEST['prepopulate'][$field_handle]));
$prepopulate_filter = "?prepopulate[{$field_handle}]=" . rawurlencode($value);
$this->Form->setAttribute('action', Administration::instance()->getCurrentPageURL() . $prepopulate_filter);
if (is_null($existing)) {
$this->entry->data()->{$field_handle}->value = $value;
}
}
// Status message:
if (isset($callback['flag']) and !is_null($callback['flag'])) {
switch ($callback['flag']) {
case 'saved':
$this->alerts()->append(__('Entry updated at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all Entries</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), ADMIN_URL . '/publish/' . $callback['context']['section_handle'] . '/new/' . $prepopulate_filter, ADMIN_URL . '/publish/' . $callback['context']['section_handle'] . '/')), AlertStack::SUCCESS);
break;
case 'created':
$this->alerts()->append(__('Entry created at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all Entries</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), ADMIN_URL . '/publish/' . $callback['context']['section_handle'] . '/new/' . $prepopulate_filter, ADMIN_URL . '/publish/' . $callback['context']['section_handle'] . '/')), AlertStack::SUCCESS);
break;
}
}
// Load all the fields for this section
$section_fields = array();
foreach ($section->fields as $index => $field) {
$section_fields[$field->{'element-name'}] = $field;
}
$layout = new Layout();
if (is_array($section->layout) && !empty($section->layout)) {
foreach ($section->layout as $data) {
$column = $layout->createColumn($data->size);
foreach ($data->fieldsets as $data) {
$fieldset = $this->createElement('fieldset');
if (isset($data->collapsed) && $data->collapsed == 'yes') {
$fieldset->setAttribute('class', 'collapsed');
}
if (isset($data->name) && strlen(trim($data->name)) > 0) {
$fieldset->appendChild($this->createElement('h3', $data->name));
}
foreach ($data->fields as $handle) {
$field = $section_fields[$handle];
if (!$field instanceof Field) {
continue;
}
$div = $this->createElement('div', NULL, array('class' => trim(sprintf('field field-%s %s %s', $field->handle(), $this->__calculateWidth($field->width), $field->required == 'yes' ? 'required' : ''))));
$field->displayPublishPanel($div, isset($this->errors->{$field->{'element-name'}}) ? $this->errors->{$field->{'element-name'}} : new MessageStack(), $this->entry, $this->entry->data()->{$field->{'element-name'}});
$fieldset->appendChild($div);
}
$column->appendChild($fieldset);
}
$layout->appendTo($this->Form);
}
} else {
$this->alerts()->append(__('You haven\'t set any section layout rules. <a href="%s">Click here to define a layout.</a>', array(ADMIN_URL . '/blueprints/sections/layout/' . $section->handle . '/')), AlertStack::ERROR);
$column = $layout->createColumn(Layout::LARGE);
$fieldset = $this->createElement('fieldset');
$header = $this->createElement('h3', __('Untitled'));
$fieldset->appendChild($header);
if (is_array($section->fields)) {
foreach ($section->fields as $field) {
$div = $this->createElement('div', NULL, array('class' => trim(sprintf('field field-%s %s %s', $field->handle(), $this->__calculateWidth($field->width), $field->required == 'yes' ? 'required' : 'optional'))));
$field->displayPublishPanel($div, isset($this->errors->{$field->{'element-name'}}) ? $this->errors->{$field->{'element-name'}} : new MessageStack(), $this->entry, $this->entry->data()->{$field->{'element-name'}});
$fieldset->appendChild($div);
}
}
$column->appendChild($fieldset);
$layout->appendTo($this->Form);
}
$div = $this->createElement('div');
$div->setAttribute('class', 'actions');
$div->appendChild(Widget::Submit('action[save]', $existing ? __('Save Changes') : __('Create Entry'), array('accesskey' => 's')));
//.........这里部分代码省略.........
示例3: Widget
<?php
require_once 'Widget.class.php';
$table = new Widget();
$table->drop();
$table_section = new Section();
$id_section = $table_section->load(array("label" => "dashboard"))->getId();
$table_section->delete(array('label' => 'dashboard'));
$table_right = new Right();
$table_right->delete(array('section' => $id_section));
示例4: KodiCmd
<?php
require_once 'KodiCmd.class.php';
// Suppression de la table du plugin
$table = new KodiCmd();
//$table->drop();
$execQuery = $table->query('DROP TABLE yana_plugin_kodi');
$table_configuration = new configuration();
$table_configuration->getAll();
$table_configuration->remove('plugin_kodiCmd_api_url_kodi');
$table_configuration->remove('plugin_kodiCmd_api_timeout_kodi');
$table_configuration->remove('plugin_kodiCmd_api_recognition_status');
// suppression de la piece KODI
$table_room = new Room();
$table_room->delete(array('name' => 'KODI'));
// Recuperation de l'id et Suppression de la section
$table_section = new Section();
$id_section = $table_section->load(array("label" => "kodi"))->getId();
$table_section->delete(array('label' => 'kodi'));
// suppression des droits correspondant à la section
$table_right = new Right();
$table_right->delete(array('section' => $id_section));
示例5: current
public function current()
{
return Section::load(self::$sections[$this->position]);
}
示例6: __loadExistingSection
private static function __loadExistingSection($handle)
{
try {
return Section::load(SECTIONS . "/{$handle}.xml");
} catch (SectionException $e) {
switch ($e->getCode()) {
case Section::ERROR_SECTION_NOT_FOUND:
throw new SymphonyErrorPage(__('The section you requested to edit does not exist.'), __('Section not found'), NULL, array('HTTP/1.0 404 Not Found'));
break;
default:
case Section::ERROR_FAILED_TO_LOAD:
throw new SymphonyErrorPage(__('The section you requested could not be loaded. Please check it is readable.'), __('Failed to load section'));
break;
}
} catch (Exception $e) {
throw new SymphonyErrorPage(sprintf(__("An unknown error has occurred. %s"), $e->getMessage()), __('Unknown Error'), NULL, array('HTTP/1.0 500 Internal Server Error'));
}
}
示例7: gettimetablecreate
protected function gettimetablecreate()
{
global $user;
global $objPDO;
$student = new student($objPDO, $user->getuserId());
$headMenu = array("username" => $student->getName());
if ($user->checkAdmin() == true && isset($_GET['uid'])) {
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/examination_section_subject_class.php';
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/examination_class.php';
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/section_class.php';
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/subject_class.php';
$exam_id = $_GET['uid'];
$exam = new Examination($objPDO, $exam_id);
$slots = $exam->getFnAn();
if ($slots == 2) {
$slots = 1;
} else {
if ($slots == 3) {
$slots = 2;
} else {
$slots = 1;
}
}
$startTime = strtotime($exam->getStartDate());
$endTime = strtotime($exam->getEndDate());
$day = 86400;
$format = 'd-m-Y';
$numDays = round(($endTime - $startTime) / $day) + 1;
$days = array();
for ($i = 0; $i < $numDays; $i++) {
$days[] = date($format, $startTime + $i * $day);
}
$rel = new ExaminationSectionSubject($objPDO);
$section_array = $rel->getByExamId($exam_id);
$section_name = array();
$subject_array = array();
$section = new Section($objPDO);
$subject = new Subject($objPDO);
foreach ($section_array as $key => $value) {
$section->setID($key);
$section->load();
$section_name[$key] = $section->getCode();
foreach ($value as $k => $v) {
$subject->setID($v);
$subject->load();
$subject_array[$key][$v] = $subject->getName();
}
$subject_array[$key][0] = "--None--";
}
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/exam_timetable_create.php';
} else {
header('Location:http://localhost/cloud');
}
}
示例8: Sensor
<?php
/*
Le code contenu dans cette page ne sera éxecuté qu'à la désactivation du plugin
Vous pouvez donc l'utiliser pour supprimer des tables SQLite, des dossiers, ou executer une action
*/
require_once 'Sensor.class.php';
require_once 'SensorType.class.php';
$table = new Sensor();
$table2 = new SensorType();
$table->drop();
$table2->drop();
$conf = new Configuration();
$conf->delete(array('key' => 'plugin_sensor_receptor_pin'));
$table_section = new Section();
$id_section = $table_section->load(array("label" => "sensor"))->getId();
$id_section2 = $table_section->load(array("label" => "sensortypes"))->getId();
$table_section->delete(array('label' => 'sensor'));
$table_section2->delete(array('label' => 'sensortypes'));
$table_right = new Right();
$table_right->delete(array('section' => $id_section));
$table_right->delete(array('section' => $id_section2));