Esempio n. 1
0
 function saveListItemProperties($item_id)
 {
     if (!($item = DynamicListItem::lookup($item_id))) {
         Http::response(404, 'No such list item');
     }
     if (!$item->setConfiguration()) {
         include STAFFINC_DIR . 'templates/list-item-properties.tmpl.php';
     } else {
         $item->save();
     }
 }
Esempio n. 2
0
 function export($value)
 {
     if ($value && is_numeric($value) && ($item = DynamicListItem::lookup($value))) {
         return $item->toString();
     }
     return $value;
 }
Esempio n. 3
0
 function getItem($val)
 {
     $criteria = array('list_id' => $this->getId());
     if (is_int($val)) {
         $criteria['id'] = $val;
     } else {
         $criteria['value'] = $val;
     }
     return DynamicListItem::lookup($criteria);
 }
Esempio n. 4
0
 function getFilterData()
 {
     // Start with the filter data for the list item as the [0] index
     $data = array(parent::getFilterData());
     if ($v = $this->getClean()) {
         // Add in the properties for all selected list items in sub
         // labeled by their field id
         foreach ($v as $id => $L) {
             if (!($li = DynamicListItem::lookup($id))) {
                 continue;
             }
             foreach ($li->getFilterData() as $prop => $value) {
                 if (!isset($data[$prop])) {
                     $data[$prop] = $value;
                 } else {
                     $data[$prop] .= " {$value}";
                 }
             }
         }
     }
     return $data;
 }