Application->SetVar($event->getPrefixSpecial(true).'_id', $event->Special); parent::OnItemBuild($event); } /** * List with one record if special passed * * @param kEvent $event */ function SetCustomQuery(&$event) { if ($event->Special) { $object =& $event->getObject(); $object->addFilter('current_module', 'Name = '.$event->Special); } } function mapEvents() { parent::mapEvents(); $this->eventMethods['OnMassApprove'] = 'moduleAction'; $this->eventMethods['OnMassDecline'] = 'moduleAction'; } /** * Disabled modules, but not In-Portal * * @param kEvent $event */ function moduleAction(&$event) { if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) { return; } $object =& $event->getObject( Array('skip_autoload' => true) ); $ids = $this->StoreSelectedIDs($event); if (!$ids) return true; $status_field = array_shift( $this->Application->getUnitOption($event->Prefix, 'StatusField') ); foreach($ids as $id) { $object->Load($id); if ($object->GetID() == 'In-Portal') continue; $object->SetDBField($status_field, $event->Name == 'OnMassApprove' ? 1 : 0); if ($object->Update()) { $event->status = erSUCCESS; $event->redirect_params = Array('opener' => 's'); //stay! } else { $event->status = erFAIL; $event->redirect = false; break; } } $this->Application->UnitConfigReader->ResetParsedData(true); //true to reset sections cache also $event->SetRedirectParam('RefreshTree', 1); } } ?>