- Record Id */ public function getId() { return $this->get('templateid'); } /** * Function to set the id of the record * @param $value - id value * @return - current instance */ public function setId($value) { return $this->set('templateid',$value); } /** * Function to delete the email template * @param type $recordIds */ public function delete(){ $this->getModule()->deleteRecord($this); } /** * Function to delete all the email templates * @param type $recordIds */ public function deleteAllRecords(){ $this->getModule()->deleteAllRecords(); } /** * Function to get template fields * To get the fields from module, which has the email field * @return template fields */ public function getEmailTemplateFields(){ return $this->getModule()->getAllModuleEmailTemplateFields(); } /** * Function to get the Email Template Record * @param type $record * @return */ public function getTemplateData($record){ return $this->getModule()->getTemplateData($record); } /** * Function to get the Detail View url for the record * @return - Record Detail View Url */ public function getDetailViewUrl() { $module = $this->getModule(); return 'index.php?module='.$this->getModuleName().'&view='.$module->getDetailViewName().'&record='.$this->getId(); } /** * Function to get the instance of Custom View module, given custom view id * @param $cvId * @return CustomView_Record_Model instance, if exists. Null otherwise */ public static function getInstanceById($templateId, $module=null) { $db = PearDatabase::getInstance(); $sql = 'SELECT * FROM vtiger_emailtemplates WHERE templateid = ?'; $params = array($templateId); $result = $db->pquery($sql, $params); if($db->num_rows($result) > 0) { $row = $db->query_result_rowdata($result, 0); $recordModel = new self(); return $recordModel->setData($row)->setModule('EmailTemplates'); } return null; } }