public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { // TODO - verify permissions for viewing lists // $detailed = $this->getP ( "detailed" , false ); $limit = $this->getP("page_size", 10); if ($limit > 30) { $limit = 30; } $page = $this->getP("page", 1); //$order_by = int( $this->getP ( "order_by" , -1 ) ); $offset = ($page - 1) * $limit; // kuserPeer::setUseCriteriaFilter( false ); $c = new Criteria(); // filter $filter = new notificationFilter(); $fields_set = $filter->fillObjectFromRequest($this->getInputParams(), "filter_", null); $filter->attachToCriteria($c); //if ($order_by != -1) kshowPeer::setOrder( $c , $order_by ); $count = notificationPeer::doCount($c); $offset = ($page - 1) * $limit; $c->setLimit($limit); if ($offset > 0) { $c->setOffset($offset); } $list = notificationPeer::doSelect($c); $level = objectWrapperBase::DETAIL_LEVEL_REGULAR; $this->addMsg("count", $count); $this->addMsg("page_size", $limit); $this->addMsg("page", $page); $wrapper = objectWrapperBase::getWrapperClass($list, $level); $this->addMsg("notifications", $wrapper); }
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { $this->addMsg("done", "1"); $notification_ids = $this->getPM("notification_ids"); $detailed = $this->getP("detailed", false); $separator = $this->getP("separator", ","); $retriesCount = $this->getP("retriesCount", 0); $retriesTotal = $this->getP("retriesTotal", 0); $id_arr = explode($separator, $notification_ids); $limit = min(50, count($id_arr)); $id_arr = array_splice($id_arr, 0, $limit); $c = new Criteria(); $c->add(notificationPeer::ID, $id_arr, Criteria::IN); $c->add(notificationPeer::STATUS, BatchJob::BATCHJOB_STATUS_FINISHED); $sentCount = notificationPeer::doCount($c); if ($retriesTotal && $retriesCount + 1 >= $retriesTotal) { $done = 1; } else { $done = $sentCount == $limit; } $this->addMsg("done", $done ? "1" : "0"); }