getObject(); $module_owner=$this->Application->GetVar('module'); if ($module_owner===false) { $module_owner=$this->myUrlDecode($this->Application->GetVar('confs_module')); $this->Application->SetVar("module", $module_owner); } $section=$this->Application->GetVar('section'); if ($section===false){ $section=$this->myUrlDecode($this->Application->GetVar('confs_section')); $this->Application->SetVar("section", $section); } $object->addFilter('module_filter', '%1$s.ModuleName = "'.$module_owner.'"'); } function OnUpdate(&$event) { if (!$this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 0)) { parent::OnUpdate($event); } $module_owner=$this->Application->GetVar('module'); $module_section=$this->Application->GetVar('section'); $conf_update = new kEvent( ); $conf_update->Init('conf'); $conf_update->Name = 'OnUpdate'; $conf_update->redirect = false; $this->Application->HandleEvent($conf_update); $event->redirect_params = Array('opener' => 's','confs_module'=>$this->myUrlEncode($module_owner),'confs_section'=>$this->myUrlEncode($module_section),'conf_module'=>$this->myUrlEncode($module_owner),'conf_section'=>$this->myUrlEncode($module_section),'pass'=>'all,confs,conf'); //stay! } function OnCancel(&$event) { parent::OnCancel($event); $module_owner=$this->Application->GetVar('module'); $module_section=$this->Application->GetVar('section'); $event->redirect_params = Array('opener' => 's','confs_module'=>$this->myUrlEncode($module_owner),'confs_section'=>$this->myUrlEncode($module_section),'conf_module'=>$this->myUrlEncode($module_owner),'conf_section'=>$this->myUrlEncode($module_section),'pass'=>'all,confs,conf'); //stay! } function myUrlDecode($str){ $str=str_replace(';',':', $str); $str=str_replace('!','-', $str); return $str; } function myUrlEncode($str){ $str=str_replace('-', '!', $str); $str=str_replace(':', ';', $str); return $str; } /** * Enter description here... * * @param kEvent $event */ function OnCreateCustomField(&$event) { $custom_field =& $event->MasterEvent->getObject(); $sql = 'SELECT Module FROM '.TABLE_PREFIX.'ItemTypes WHERE ItemType = '.$custom_field->GetDBField('Type'); $module_name = $this->Conn->GetOne($sql); $object =& $event->getObject( Array('skip_autoload' => true) ); $custom_id = $custom_field->GetID(); if ($custom_id) { $object->Load($custom_id, 'CustomFieldId'); $object->SetDBField('CustomFieldId', $custom_id); // for cloning only } $cf_search = Array(); $cf_search['DisplayOrder'] = $custom_field->GetDBField('DisplayOrder'); $cf_search['ElementType'] = $custom_field->GetDBField('ElementType'); $cf_search['DisplayName'] = $custom_field->GetDBField('FieldLabel'); $cf_search['FieldName'] = $custom_field->GetDBField('FieldName'); $cf_search['Description'] = $custom_field->GetDBField('Prompt'); $cf_search['ConfigHeader'] = $custom_field->GetDBField('Heading'); // 'la_Text_CustomFields'; $cf_search['TableName'] = 'CustomField'; $cf_search['ModuleName'] = $module_name; $cf_search['ForeignField'] = 'CustomMetaData.Value'; $cf_search['JoinClause'] = '{ForeignTable}.ResourceId={LocalTable}.ResourceId'; $object->SetFieldsFromHash($cf_search); $result = $object->isLoaded() ? $object->Update() : $object->Create(); } } ?>