Esempio n. 1
0
 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');
 }
Esempio n. 2
0
 function getList()
 {
     if (!$this->_list) {
         $this->_list = DynamicList::lookup($this->getListId());
     }
     return $this->_list;
 }
Esempio n. 3
0
 static function getStatuses($criteria = array())
 {
     $statuses = array();
     if ($list = DynamicList::lookup(array('type' => 'ticket-status'))) {
         $statuses = $list->getItems($criteria);
     }
     return $statuses;
 }
Esempio n. 4
0
         } 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;
 }