<?php

class Settings_AtomsMSmtp_Edit_View extends Settings_Vtiger_Index_View {

	public function process(Vtiger_Request $request) {
		//ini_set('display_errors','off');
		$viewer = $this->getViewer($request);
		$qualifiedName = $request->getModule(false);
		$recordId = $request->get('recordId');
		$recordModel = new Settings_AtomsMSmtp_Record_Model();
		if( $recordId == "" ) {
			$record = $recordModel->getRecordDetails();	
		}
		else{
			$record = $recordModel->getRecordDetails($recordId);
		}
		$listview_URL = $recordModel->getListViewUrl(); 
		$record['sharedusers'] = Zend_Json::decode( decode_html( $record['sharedusers'] ) );
		if($record['sharedusers'] == ''){
			$record['sharedusers'] = Array();
		}

		$viewer->assign('RECORD',$record);
		$viewer->assign('recordId' , $recordId );
		$viewer->assign('QUALIFIED_MODULE', $qualifiedName);
		$viewer->assign('CURRENT_USER_MODEL', Users_Record_Model::getCurrentUserModel());
		$USERSLIST = Users_Record_Model::getAll();
		$viewer->assign("USERSLIST" , $USERSLIST );
		$viewer->assign('LSITVIEWURL',$listview_URL);
		$viewer->view('Edit.tpl',$qualifiedName);
	}

        function getPageTitle(Vtiger_Request $request) {
                $qualifiedModuleName = $request->getModule(false);
                return vtranslate('Edit Server',$qualifiedModuleName);
        }

        /**
         * Function to get the list of Script models to be included
         * @param Vtiger_Request $request
         * @return <Array> - List of Vtiger_JsScript_Model instances
         */
        function getHeaderScripts(Vtiger_Request $request) {
                $headerScriptInstances = parent::getHeaderScripts($request);
                $moduleName = $request->getModule();

                $jsFileNames = array(
                        "modules.Settings.$moduleName.resources.SettingsEdit"
                );

                $jsScriptInstances = $this->checkAndConvertJsScripts($jsFileNames);
                $headerScriptInstances = array_merge($headerScriptInstances, $jsScriptInstances);
                return $headerScriptInstances;
        }
}

?>
