function listVideoPage($filter = []) { $data = $this->implementation->ReadMany($filter, ['sort' => ['date' => -1]]); $f = $_GET['f']; ?> <!-- <div class="richlist-top-bar theme-color"> <span><i class="material-icons">add</i>Add</span> </div> --> <div class="row"> <div class="small-12 large-8 column"> <div class="list-filter"> Filter <span class="links"> <a href="./?a=video" class="<?php if (!$f) { echo "active"; } ?> ">All</a> <a href="./?a=video&f=live" class="<?php if ($f == "live") { echo "active"; } ?> ">Live</a> <a href="./?a=video&f=vod" class="<?php if ($f == "vod") { echo "active"; } ?> ">VOD</a> </span> </div> <?php $list_data = self::convert_list($data); $list = new DynamicList($list_data, "videolist"); $list->display(); ?> </div> <div class="small-12 large-4 column video-info" id="video-preview-section"> <div class="video-preview-parent"> <div class="video-preview-container"> <div class="video-preview"></div> </div> </div> <div class="video-info-text"> <p>Select a video to load preview</p> </div> <div class="video-info-actions theme-color"></div> </div> </div> <?php }
function run($max_time) { global $cfg; $i18n = new Internationalization($cfg->get('system_language', 'en_US')); $sequences = $i18n->getTemplate('sequence.yaml')->getData(); foreach ($sequences as $s) { Sequence::create($s)->save(); } db_query('UPDATE '.SEQUENCE_TABLE.' SET `next`= ' .'(SELECT MAX(ticket_id)+1 FROM '.TICKET_TABLE.') ' .'WHERE `id`=1'); require_once(INCLUDE_DIR . 'class.list.php'); $lists = $i18n->getTemplate('list.yaml')->getData(); foreach ($lists as $l) { DynamicList::create($l); } $statuses = $i18n->getTemplate('ticket_status.yaml')->getData(); foreach ($statuses as $s) { TicketStatus::__create($s); } // Initialize MYSQL search backend MysqlSearchBackend::__init(); }
public function Field($properties = array()) { Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js'); Requirements::javascript(DYNAMICLIST_MODULE . '/javascript/DependentDynamicListDropdownField.js'); $listItems = array(); if (is_string($this->dependentLists)) { $list = DynamicList::get_dynamic_list($this->dependentLists); if ($list) { $this->dependentLists = $list->Items()->map('Title', 'Title')->toArray(); } } if (!is_array($this->dependentLists)) { $this->dependentLists = array(); } foreach ($this->dependentLists as $k => $v) { $list = DynamicList::get_dynamic_list($k); if ($list) { $listItems[$k] = $list->Items()->map('Title', 'Title')->toArray(); } } $this->setAttribute('data-listoptions', Convert::raw2json($listItems)); $this->setAttribute('data-dependentOn', $this->dependentOn); if ($this->value) { $this->setAttribute('data-initialvalue', $this->value); } return parent::Field(); }
protected function processRecord($record, $columnMap, &$results, $preview = false) { $class = $this->objectClass; $title = trim($record['Title']); $item = trim($record['ListItem']); $existingList = DynamicList::get_dynamic_list($title); if (!$existingList) { $existingList = new DynamicList(); $existingList->Title = $title; $existingList->write(); } // now add the item to that list $existingItem = DataObject::get_one('DynamicListItem', '"Title"=\'' . Convert::raw2sql($item) . '\' AND "ListID" = ' . (int) $existingList->ID); if (!$existingItem) { $existingItem = new DynamicListItem(); $existingItem->Title = $item; $existingItem->ListID = $existingList->ID; $existingItem->write(); } }
function saveListItemProperties($list_id, $item_id) { $list = DynamicList::lookup($list_id); if (!$list || !($item = $list->getItem((int) $item_id))) { Http::response(404, 'No such list item'); } if (!$item->setConfiguration()) { include STAFFINC_DIR . 'templates/list-item-properties.tmpl.php'; return; } else { $item->save(); } Http::response(201, 'Successfully updated record'); }
function __construct($name, $title = null, $source = null, $value = "", $form = null, $emptyString = null) { if (!$source) { $source = array(); } if (is_string($source)) { // it should be the name of a list, lets get all its contents $dynamicList = DynamicList::get_dynamic_list($source); $source = array(); if ($dynamicList) { $items = $dynamicList->Items(); foreach ($items as $item) { $source[$item->Title] = $item->Title; } } } $this->addExtraClass('dropdown'); parent::__construct($name, $title, $source, $value, $form, $emptyString); }
function getFormField() { $sourceList = $this->getSetting('SourceList') ? $this->getSetting('SourceList') : null; // first off lets go and output all the options we need $fields = $this->Parent()->Fields(); $source = null; foreach ($fields as $field) { if ($field->Name == $sourceList) { $source = $field; break; } } $optionLists = array(); if ($source) { // all our potential lists come from the source list's dynamic list source, so we need to go load that // first, then iterate it and build all the additional required lists $sourceList = DynamicList::get_dynamic_list($source->getSetting('ListTitle')); if ($sourceList) { $items = $sourceList->Items(); // now lets create a bunch of option fields foreach ($items as $sourceItem) { // now get the dynamic list that is represented by this one $list = DynamicList::get_dynamic_list($sourceItem->Title); if ($list) { $optionLists[$sourceItem->Title] = $sourceItem->Title; } } } if (count($optionLists)) { return new DependentDynamicListDropdownField($this->Name, $this->Title, $optionLists, $source->Name); } else { return new DropdownField($this->Name, $this->Title, array()); } } // return a new list return new LiteralField($this->Name); }
} elseif ($errors) { $errors['err'] = sprintf(__('Unable to add %s. Correct error(s) below and try again.'), __('this custom list')); } else { $errors['err'] = sprintf(__('Unable to add %s.'), __('this custom list')) . ' ' . __('Internal error occurred'); } break; case 'mass_process': if (!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) { $errors['err'] = sprintf(__('You must select at least %s'), __('one custom list')); } else { $count = count($_POST['ids']); switch (strtolower($_POST['a'])) { case 'delete': $i = 0; foreach ($_POST['ids'] as $k => $v) { if (($t = DynamicList::lookup($v)) && $t->delete()) { $i++; } } if ($i && $i == $count) { $msg = sprintf(__('Successfully deleted %s'), _N('selected custom list', 'selected custom lists', $count)); } elseif ($i > 0) { $warn = sprintf(__('%1$d of %2$d %3$s deleted'), $i, $count, _N('selected custom list', 'selected custom lists', $count)); } elseif (!$errors['err']) { $errors['err'] = sprintf(__('Unable to delete %s — they may be in use on a custom form'), _N('selected custom list', 'selected custom lists', $count)); } break; } } break; }
<form action="lists.php" method="POST" name="lists"> <?php csrf_token(); ?> <input type="hidden" name="do" value="mass_process" > <input type="hidden" id="action" name="a" value="" > <table class="list" border="0" cellspacing="1" cellpadding="0" width="940"> <caption>Custom Lists</caption> <thead> <tr> <th width="7"> </th> <th><?php echo __('List Name'); ?></th> <th><?php echo __('Created') ?></th> <th><?php echo __('Last Updated'); ?></th> </tr> </thead> <tbody> <?php foreach (DynamicList::objects()->order_by('-type', 'name') ->limit($pageNav->getLimit()) ->offset($pageNav->getStart()) as $list) { $sel = false; if ($ids && in_array($form->get('id'),$ids)) $sel = true; ?> <tr> <td> <?php if ($list->isDeleteable()) { ?> <input width="7" type="checkbox" class="ckb" name="ids[]" value="<?php echo $list->getId(); ?>" <?php echo $sel?'checked="checked"':''; ?>> <?php } else { echo ' ';
<br class="clear"> <div class="shortcut"> <?php //все shortcut-группы с тегом homepage if ($shortcutGroups) { foreach ($shortcutGroups as $key => $group) { $this->widget('ProductsGroupPortlet', ['id' => 'products-group-portlet-' . $key, 'linkTitle' => $group['name'], 'item_count' => 5, 'arrow' => false, 'bigImg' => 'big', 'shoppingCart' => '<i class="fa fa-shopping-cart mr8"></i>в корзину', 'portlet_width' => '100%', 'ids' => $group['shortcuts']]); ?> <br class="clear"><?php } } ?> </div> <!-- Сегодня покупают --> <div class="d1-d2 rel clearfix"> <?php $buyToday = DynamicList::getItems('segodnya-pokupayut', 'Product'); if (!empty($buyToday)) { $this->widget('ProductsGroupPortlet', ['id' => 'buy-today', 'linkTitle' => 'Сегодня покупают', 'item_count' => 5, 'arrow' => false, 'portlet_width' => '100%', 'dataProvider' => $buyToday]); } ?> </div> <?php // widget ВЫ УЖЕ СМОТРЕЛИ $this->widget('RecentlyViewedItemsWidget', ['linkHtmlOptions' => ['class' => 'd3']]); ?> </div>
echo $errors['name']; ?> </td> </tr> <tr> <td width="180">Plural Name:</td> <td><input size="50" type="text" name="name_plural" value="<?php echo $info['name_plural']; ?> "/></td> </tr> <tr> <td width="180">Sort Order:</td> <td><select name="sort_mode"> <?php foreach (DynamicList::getSortModes() as $key => $desc) { ?> <option value="<?php echo $key; ?> " <?php if ($key == $info['sort_mode']) { echo 'selected="selected"'; } ?> ><?php echo $desc; ?> </option> <?php }
echo __('List Name'); ?> </th> <th><?php echo __('Created'); ?> </th> <th><?php echo __('Last Updated'); ?> </th> </tr> </thead> <tbody> <?php foreach (DynamicList::objects()->order_by('-type', 'name')->limit($pageNav->getLimit())->offset($pageNav->getStart()) as $list) { $sel = false; if ($ids && in_array($form->get('id'), $ids)) { $sel = true; } ?> <tr> <td> <?php if ($list->isDeleteable()) { ?> <input width="7" type="checkbox" class="ckb" name="ids[]" value="<?php echo $list->getId(); ?> "
/** * Override method for validation to use dynamic list based off the * parent's value. Overridden due to null source. * @param type $validator * @return bool */ public function validate($validator) { // Source isn't pulled in correctly and we're going to rectify this // later on, so this can be an empty array for now. $source = array(); $disabled = $this->getDisabledItems(); // Grab the parent list we're trying to validate against first so we can refer to it. $parentListName = $this->getForm()->Fields()->fieldByName($this->dependentOn)->value; // Use the items from the Dynamic list as the "source" for validation purposes $parentList = DynamicList::get_dynamic_list($parentListName); if ($parentList) { $source = $parentList->Items()->map('Title', 'Title')->toArray(); } // Carry on as normal validating against our new source! // Since there's no data if the list doesn't exist, then of course it will fail if (!array_key_exists($this->value, $source) || in_array($this->value, $disabled)) { if ($this->getHasEmptyDefault() && !$this->value) { return true; } $validator->validationError($this->name, _t('DropdownField.SOURCE_VALIDATION', "Please select a value within the list provided. {value} is not a valid option", array('value' => $this->value)), "validation"); return false; } return true; }
/** * Convenience method for getting a data list * * @param String $title * @return DataObject */ public static function get_dynamic_list($title) { $list = DynamicList::get()->filter('Title', $title)->first(); return $list; }
static function __load() { require_once INCLUDE_DIR . 'class.i18n.php'; $i18n = new Internationalization(); $tpl = $i18n->getTemplate('list.yaml'); foreach ($tpl->getData() as $f) { if ($f['type'] == 'ticket-status') { $list = DynamicList::create($f); $list->save(); break; } } if (!$list || !($o = DynamicForm::objects()->filter(array('type' => 'L' . $list->getId())))) { return false; } // Create default statuses if ($statuses = $i18n->getTemplate('ticket_status.yaml')->getData()) { foreach ($statuses as $status) { TicketStatus::__create($status); } } return $o[0]; }
echo $list->getPluralName(); } else { echo sprintf('<input size="50" type="text" name="name_plural" value="%s"/>', $info['name_plural']); } ?> </td> </tr> <tr> <td width="180"><?php echo __('Sort Order'); ?> :</td> <td><select name="sort_mode"> <?php $sortModes = $list ? $list->getSortModes() : DynamicList::getSortModes(); foreach ($sortModes as $key => $desc) { ?> <option value="<?php echo $key; ?> " <?php if ($key == $info['sort_mode']) { echo 'selected="selected"'; } ?> ><?php echo $desc; ?> </option> <?php
function PrintItemList() { $data = $this->implementation->ReadMany([]); $data = $this->PrepareData($data); if (count($data) > 0) { $list = new DynamicList($data, "datalist"); $list->display(); } else { echo "<div class=\"list\"><div class=\"listcontrols\"><span class=\"empty\">No items</span></div></div>"; } }
function getList() { if (!$this->_list) { $this->_list = DynamicList::lookup($this->getListId()); } return $this->_list; }
<div style="<?php echo $hide; ?> "> <?php $this->widget('ProductsGroupPortlet', ['id' => 'buy-with-product-group', 'linkTitle' => 'С этим продуктом покупают', 'item_count' => 5, 'portlet_width' => '800px', 'noPagination' => true, 'run_carousel' => true, 'arrow' => false, 'ids' => CHtml::listData($product->buywithproducts, 'id_similar_product', 'id_similar_product'), 'linkHtmlOptions' => ['class' => 'd1-d2 products-group-portlet']]); ?> </div> <!-- widget ВЫ УЖЕ СМОТРЕЛИ --> <?php $this->widget('RecentlyViewedItemsWidget', ['linkHtmlOptions' => ['class' => 'd3']]); ?> <?php if ($dataProvider = DynamicList::getItems('segodnya-pokupayut', 'Product', 20)) { ?> <div class="d1-d2 rel clearfix"> <?php $this->widget('ProductsGroupPortlet', ['id' => 'buy-today', 'linkTitle' => 'Сегодня покупают', 'item_count' => 5, 'noPagination' => true, 'arrow' => true, 'run_carousel' => true, 'portlet_width' => '800px', 'dataProvider' => $dataProvider, 'linkHtmlOptions' => ['class' => 'products-group-portlet']]); ?> </div> <?php } ?> <div class="d3"> <?php echo BannerProduct::model()->getProductBanner('leviy-banner-produkta', $product, 1, $min = 0, $size = 'big'); ?> <a href="#" class="block mt25"><img src="<?php