Application->getUnitOption('#file', 'Clones'); $clones[$event->MasterEvent->Prefix.'-file'] = Array ( 'ParentPrefix' => $event->MasterEvent->Prefix, ); $this->Application->setUnitOption('#file', 'Clones', $clones); } /** * Remembers user, who is created file record. Makes file primary if no other files are uploaded. * * @param kEvent $event */ function OnBeforeItemCreate(&$event) { $object->SetDBField('CreatedById', $this->Application->RecallVar('user_id')); } /** * Resets primary file mark when more then one file is marked as primary * * @param kEvent $event */ function OnBeforeItemUpdate(&$event) { $object =& $event->getObject(); if (!$object->GetDBField('FileName')) { $object->SetDBField('FileName', basename($object->GetDBField('FilePath'))); } } function SetCustomQuery(&$event) { parent::SetCustomQuery($event); $object =& $event->getObject(); if (!$this->Application->IsAdmin()) { $object->addFilter('active_filter', '%1$s.Status = '.STATUS_ACTIVE); } } } ?>