示例#1
0
 /**
  * Total clean up, danger
  */
 function action_drop_all()
 {
     $this->_load();
     if (is_callable(array($this, 'action_drop_all_before'))) {
         $this->action_drop_all_before();
     }
     $count = $this->collection->count();
     $this->collection->remove_all();
     if (is_callable(array($this, 'action_drop_all_after'))) {
         $this->action_drop_all_after();
     }
     if ($this->in_ajax()) {
         $this->_ajax_answer((bool) $count, i18n::T('Items deleted'), $count);
     } else {
         $this->set_message(i18n::T('Items deleted'));
     }
     $this->disable_render(true);
 }
示例#2
0
 /**
  * compare 2 collections
  * @return bool
  */
 public function compare(abs_collection $subj)
 {
     $subj->rewind();
     while ($item = $subj->next()) {
         if (!(($tmp = $this->get_element_by_id($item->id)) && $tmp->get_data() == $item->get_data())) {
             return false;
         }
     }
     if ($subj->count() != $this->count()) {
         return false;
     }
     // passed
     return true;
 }