/** * Edit a Audio * * @param mod_profile_Audio $audioObj object to be edited */ function editaudio($audioObj, $hideForm = false) { global $profile_audio_handler, $icmsTpl; $icmsTpl->assign('hideForm', $hideForm); if (!$audioObj->isNew()) { if (!$audioObj->userCanEditAndDelete()) { redirect_header($audioObj->getItemLink(true), 3, _NOPERM); } $audioObj->hideFieldFromForm(array('creation_time', 'uid_owner', 'url')); $sform = $audioObj->getSecureForm($hideForm ? '' : _MD_PROFILE_AUDIOS_EDIT, 'addaudio'); $sform->assign($icmsTpl, 'profile_audioform'); $icmsTpl->assign('lang_audioform_title', _MD_PROFILE_AUDIOS_EDIT); } else { if (!$profile_audio_handler->userCanSubmit()) { redirect_header(PROFILE_URL, 3, _NOPERM); } if (!$profile_audio_handler->checkUploadLimit()) { return; } $audioObj->setVar('uid_owner', icms::$user->getVar('uid')); $audioObj->setVar('creation_time', date(_DATESTRING)); $audioObj->hideFieldFromForm(array('creation_time', 'uid_owner')); $sform = $audioObj->getSecureForm($hideForm ? '' : _MD_PROFILE_AUDIOS_SUBMIT, 'addaudio'); $sform->assign($icmsTpl, 'profile_audioform'); $icmsTpl->assign('lang_audioform_title', _MD_PROFILE_AUDIOS_SUBMIT); } }
/** * AfterInsert event * * Event automatically triggered by IcmsPersistable Framework after the object is inserted * * @param mod_profile_Audio $obj object * @return bool true */ protected function afterInsert(&$obj) { $thisUser = icms::handler("icms_member")->getUser($obj->getVar('uid_owner')); $module = icms::handler("icms_module")->getByDirname(basename(dirname(dirname(__FILE__))), TRUE); $tags['AUDIO_TITLE'] = $obj->getVar('title'); $tags['AUDIO_OWNER'] = $thisUser->getVar('uname'); $tags['AUDIO_URL'] = ICMS_URL . '/modules/' . basename(dirname(dirname(__FILE__))) . '/audio.php?uid=' . $obj->getVar('uid_owner'); icms::handler('icms_data_notification')->triggerEvent('audio', $obj->getVar('uid_owner'), 'new_audio', $tags, array(), $module->getVar('mid')); return true; }