<b><?php echo CHtml::encode($data->getAttributeLabel('id')); ?> :</b> <?php echo CHtml::link(CHtml::encode($data->id), array('view', 'id' => $data->id)); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('param_id')); ?> :</b> <?php echo CHtml::encode(Param::model()->findByPk($data->param_id)->name); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('value')); ?> :</b> <?php echo CHtml::encode($data->value); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('reg_id')); ?>
public function replaceMarks($text, User $user) { $params = Param::model()->getValues(); $params['{{ACTIVATE_ACCOUNT_HREF}}'] = Yii::app()->createAbsoluteUrl('/activateAccount/' . $user->activate_code); $params['{{CHANGE_PASSWORD_HREF}}'] = Yii::app()->createAbsoluteUrl('/changePassword/' . $user->password_recover_code); return Yii::app()->text->parseTemplate($text, $params); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Param the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Param::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public static function sendMail($email_to, $subject, $body) { Param::checkRequired(array(self::PARAM_FROM_EMAIL, self::PARAM_FROM_NAME, self::PARAM_REPLY_EMAIL, self::PARAM_HOST, self::PARAM_PORT, self::PARAM_LOGIN, self::PARAM_PASSWORD)); require_once LIBRARIES_PATH . 'PHPMailer/class.phpmailer.php'; $settings = Param::model()->findCodesValues('mailer'); $encoding = "utf-8"; $hidden_copy = true; $subject = iconv($encoding, "{$encoding}//IGNORE", $subject); $from_name = iconv($encoding, "{$encoding}//IGNORE", $settings[self::PARAM_FROM_NAME]); $from_email = iconv($encoding, "{$encoding}//IGNORE", $settings[self::PARAM_FROM_EMAIL]); $reply_email = iconv($encoding, "{$encoding}//IGNORE", $settings[self::PARAM_REPLY_EMAIL]); $mail = new PHPMailer(true); $mail->IsSMTP(); $mail->CharSet = $encoding; $mail->SMTPDebug = 1; $mail->Host = $settings[self::PARAM_HOST]; $mail->SMTPAuth = true; $mail->SMTPKeepAlive = true; $mail->Port = $settings[self::PARAM_PORT]; $mail->Username = $settings[self::PARAM_LOGIN]; $mail->Password = $settings[self::PARAM_PASSWORD]; $mail->AddReplyTo($reply_email, $from_name); $add_address_method = $hidden_copy ? 'AddBCC' : 'AddAddress'; if (is_array($email_to)) { foreach ($email_to as $ind => $email) { $mail->{$add_address_method}($email, $email); } } else { $mail->{$add_address_method}($email_to, $email_to); } $mail->SetFrom($from_email, $from_name); $mail->Subject = $subject; $mail->MsgHTML(iconv($encoding, "{$encoding}//IGNORE", $body)); $mail->Send(); $mail->ClearAttachments(); $mail->ClearBCCs(); $mail->ClearAddresses(); }