本文整理汇总了PHP中Msg类的典型用法代码示例。如果您正苦于以下问题:PHP Msg类的具体用法?PHP Msg怎么用?PHP Msg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Msg类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: send
public function send(Msg $msg)
{
// Get template file path.
$templatePath = SPrintF('Notifies/Jabber/%s.tpl', $msg->getTemplate());
$smarty = JSmarty::get();
if (!$smarty->templateExists($templatePath)) {
throw new jException('Template file not found: ' . $templatePath);
}
$smarty->assign('Config', Config());
foreach (array_keys($msg->getParams()) as $paramName) {
$smarty->assign($paramName, $msg->getParam($paramName));
}
try {
$message = $smarty->fetch($templatePath);
} catch (Exception $e) {
throw new jException(SPrintF("Can't fetch template: %s", $templatePath), $e->getCode(), $e);
}
$recipient = $msg->getParam('User');
if (!$recipient['Params']['NotificationMethods']['Jabber']['Address']) {
throw new jException("JabberID not found for user: " . $recipient['ID']);
}
$taskParams = array('UserID' => $recipient['ID'], 'TypeID' => 'Jabber', 'Params' => array($recipient['Params']['NotificationMethods']['Jabber']['Address'], $message, $recipient['ID']));
$result = Comp_Load('www/Administrator/API/TaskEdit', $taskParams);
switch (ValueOf($result)) {
case 'error':
throw new jException("Couldn't add task to queue: " . $result);
case 'exception':
throw new jException("Couldn't add task to queue: " . $result->String);
case 'array':
return TRUE;
default:
throw new jException("Unexpected error.");
}
}
开发者ID:carriercomm,项目名称:jbs,代码行数:34,代码来源:Jabber.class.php
示例2: add
function add($params)
{
$re = $this->db->exec("insert into `progress` set \n\t\t\t\tbusiness_id=:business_id,\n\t\t\t\tprocess_id=:process_id,\n\t\t\t\tnote=:note,\n\t\t\t\tdate_end=:date_end,\n\t\t\t\tcreate_time=now()\n\t\t\t", $params);
if ($re == 1) {
include 'msg.php';
$msg = new Msg($params['business_id'], 'business');
$msg->pushMessage('工商注册', '尊敬的客户你的工商注册进度更新了');
}
return $re;
}
开发者ID:nongfuguoyuan,项目名称:accountant,代码行数:10,代码来源:progress.php
示例3: delete
public function delete($id)
{
try {
$msg = new Msg($id);
if (UserHelper::getProfileId() != $msg->getReceiver() and !UserHelper::isEditor()) {
throw new fValidationException('not allowed');
}
$msg->delete();
$this->ajaxReturn(array('result' => 'success'));
} catch (fException $e) {
$this->ajaxReturn(array('result' => 'failure', 'message' => $e->getMessage()));
}
}
开发者ID:daerduoCarey,项目名称:xiaoyou,代码行数:13,代码来源:MsgController.php
示例4: beforeSave
public function beforeSave()
{
if ($this->id && $this->id == $this->parent_id) {
$this->parent_id = 0;
\Msg::add('Категория не может быть сама себе родителем');
}
}
开发者ID:krvd,项目名称:cms-Inji,代码行数:7,代码来源:Category.php
示例5: editorAction
public function editorAction($module)
{
if (!file_exists(Module::getModulePath($module) . '/generatorHash.php')) {
Msg::add('Этот модуль был создан без помощи генератора. Возможности его изменения ограничены и могут привести к порче модуля', 'danger');
}
$this->view->page(['data' => compact('module')]);
}
开发者ID:krvd,项目名称:cms-Inji,代码行数:7,代码来源:ModulesController.php
示例6: actionNewmsg
public function actionNewmsg()
{
$model = new Msg();
if (isset($_POST['Msg'])) {
$model->uid = Yii::app()->user->id;
$model->time = time();
$model->state = 1;
$model->attributes = $_POST['Msg'];
if ($model->save()) {
$this->redirect_message('私信发送成功!', 'success', '3', $this->createUrl('msg/inbox'));
}
}
$fans = Follow::model()->findAll('touid = ' . Yii::app()->user->id);
$data = array('model' => $model, 'fans' => $fans);
$this->render('newmsg', $data);
}
开发者ID:SallyU,项目名称:footprints,代码行数:16,代码来源:MsgController.php
示例7: twitter_process_messages
/**
* loop through twitter messages, put them to database and send them to qaul app
*/
function twitter_process_messages($data, $type)
{
foreach ($data as $item) {
// check if message already exists
$msg = MsgQuery::create()->filterByTwitterid($item->id_str)->findOne();
if (!$msg) {
// save message in data base
$msg = new Msg();
$msg->setType($type);
$msg->setName($item->user->screen_name);
$msg->setMsg($item->text);
$msg->setIp(get_qaul_setting('ip'));
$msg->setTime($item->created_at);
$msg->setStatus(0);
$msg->setTwitterid($item->id_str);
$msg->save();
// send message to qaul app
twitter_send2qaul($msg);
}
}
}
开发者ID:hecekgl,项目名称:qaul.net,代码行数:24,代码来源:twitter_functions.php
示例8: actionDelete
public function actionDelete($id)
{
//$this->loadModel($id)->delete();
$model = Msg::model()->findByPk($id);
if ($model->delete()) {
//添加成功时候的提示信息设置
/**
*setFlash getFlash hasFlash 几个方法
*/
Yii::app()->user->setFlash('shanchu', '删除成功!');
}
$this->redirect('./index.php?r=backend/msg/index');
}
开发者ID:SallyU,项目名称:footprints,代码行数:13,代码来源:MsgController.php
示例9: message
function message($key = "message.defaultMessage", $scope = "global") {
$retval = "";
$sessionMsg = Session::load(MSG_SCOPE, $scope);
if (!empty($sessionMsg)) {
reset($sessionMsg);
$retval .= Msg::get("message.extra.warning");
foreach ($sessionMsg as $message) {
$retval .= "<div>".$message["string"]."</div>\n";
}
} else {
$retval = Msg::get("message.extra.tooltip").Msg::get($key);
}
return $retval;
}
开发者ID:reekoheek,项目名称:php-fw,代码行数:15,代码来源:Msg.php
示例10: _getAccessToken
/**
* @descrpition 从微信服务器获取微信ACCESS_TOKEN
* @return Ambigous|bool
*/
private static function _getAccessToken()
{
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . WECHAT_APPID . '&secret=' . WECHAT_APPSECRET;
$accessToken = Curl::callWebServer($url, '', 'GET');
if (!isset($accessToken['access_token'])) {
return Msg::returnErrMsg(MsgConstant::ERROR_GET_ACCESS_TOKEN, '获取ACCESS_TOKEN失败');
}
$accessToken['time'] = time();
$accessTokenJson = json_encode($accessToken);
//存入数据库
$db = new mysql();
$db->connect(DBHOST, DBUSER, DBPASSWORD, DBNAME);
$sql = "update accesstoken set access_token='" . $accessTokenJson . "' where id=1";
$db->query($sql);
return $accessToken;
}
开发者ID:heshaohua,项目名称:CTNewMedia,代码行数:20,代码来源:accesstoken.lib.php
示例11: _getAccessToken
/**
* @descrpition 从微信服务器获取微信ACCESS_TOKEN
* @return Ambigous|bool
*/
private function _getAccessToken()
{
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . WECHAT_APPID . '&secret=' . WECHAT_APPSECRET;
$accessToken = Curl::callWebServer($url, '', 'GET');
if (!isset($accessToken['access_token'])) {
return Msg::returnErrMsg(MsgConstant::ERROR_GET_ACCESS_TOKEN, '获取ACCESS_TOKEN失败');
}
$accessToken['time'] = time();
$accessTokenJson = json_encode($accessToken);
//存入数据库
/**
* 这里通常我会把access_token存起来,然后用的时候读取,判断是否过期,如果过期就重新调用此方法获取,存取操作请自行完成
*
* 请将变量$accessTokenJson给存起来,这个变量是一个字符串
*/
return $accessToken;
}
开发者ID:GaryZhan,项目名称:wenwan,代码行数:21,代码来源:accesstoken.lib.php
示例12: _getJsapiTicket
/**
* @descrpition 从微信服务器获取js sdk api_ticket
* @return Ambigous|bool
*/
private static function _getJsapiTicket()
{
$accessToken = AccessToken::getAccessToken();
$url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token=" . $accessToken;
$JsapiTicket = Curl::callWebServer($url, '', 'GET');
if (!isset($JsapiTicket['ticket'])) {
return Msg::returnErrMsg(MsgConstant::ERROR_GET_ACCESS_TOKEN, '获取js ticket失败');
}
$JsapiTicket['time'] = time();
$JsapiTicketJson = json_encode($JsapiTicket);
//存入数据库
$db = new mysql();
$db->connect(DBHOST, DBUSER, DBPASSWORD, DBNAME);
$sql = "update jsapiticket set ticket='" . $JsapiTicketJson . "' where id=1";
$db->query($sql);
return $JsapiTicket;
}
开发者ID:heshaohua,项目名称:CTNewMedia,代码行数:21,代码来源:jsapiticket.lib.php
示例13: parseRequest
public function parseRequest($request)
{
if (!empty($request[$this->colName]['pass']) && !empty($request[$this->colName]['pass'])) {
if (empty($request[$this->colName]['pass'])) {
\Msg::add('Вы не ввели пароль в первое поле', 'danger');
return FALSE;
}
if (empty($request[$this->colName]['repeat'])) {
\Msg::add('Вы не ввели пароль во второе поле', 'danger');
return FALSE;
}
if ($request[$this->colName]['pass'] != $request[$this->colName]['repeat']) {
\Msg::add('Введенные пароли не совадают', 'danger');
return FALSE;
}
$this->activeForm->model->{$this->colName} = \App::$cur->users->hashpass($request[$this->colName]['pass']);
}
}
开发者ID:krvd,项目名称:cms-Inji,代码行数:18,代码来源:ChangePassword.php
示例14: init
public function init()
{
\App::$cur->view->customAsset('js', '/static/moduleAsset/UserForms/js/formCatcher.js');
if (!empty($_POST['UserForms'])) {
foreach ($_POST['UserForms'] as $form_id => $inputs) {
$form = \UserForms\Form::get((int) $form_id);
if (!$form) {
continue;
}
$formRecive = new \UserForms\Recive();
$formRecive->user_id = (int) \Users\User::$cur->id;
$formRecive->form_id = (int) $form_id;
$data = [];
$error = false;
foreach ($form->inputs as $input) {
if (isset($inputs['input' . $input->id])) {
$data['input' . $input->id] = htmlspecialchars($inputs['input' . $input->id]);
} elseif ($input->required) {
$error = true;
Msg::add('Вы не заполнили поле: ' . $input->label);
} else {
$data['input' . $input->id] = '';
}
}
if (!$error) {
$formRecive->data = json_encode($data);
$formRecive->save();
}
}
if (!$error && !empty(App::$cur->config['site']['email'])) {
$text = '';
foreach ($form->inputs as $input) {
if (isset($inputs['input' . $input->id])) {
$text .= "<b>{$input->label}:</b> " . htmlspecialchars($inputs['input' . $input->id]) . "<br />";
}
}
if ($text) {
$text = 'Дата получения по серверному времени: ' . date('Y-m-d H:i:s') . '<br />Заполненые поля:<br />' . $text;
Tools::sendMail('noreply@' . INJI_DOMAIN_NAME, App::$cur->config['site']['email'], $form->name, $text);
}
}
Tools::redirect($_SERVER['REQUEST_URI'], 'Ваша форма была успешно отправлена', 'success');
}
}
开发者ID:krvd,项目名称:cms-Inji,代码行数:44,代码来源:UserForms.php
示例15: datetime
function datetime($format, Date $date) {
// TODO you can only use dd MM yy yyyy HH mm ss
$format = Msg::get($format);
$patterns[0] = '/dd/';
$patterns[1] = '/MM/';
$patterns[2] = '/yyyy/';
$patterns[3] = '/yy/';
$patterns[4] = '/HH/';
$patterns[5] = '/mm/';
$patterns[6] = '/ss/';
$replacements[6] = sprintf("%02d", $date->date);
$replacements[5] = sprintf("%02d", $date->month);
$replacements[4] = sprintf("%04d", $date->year);
$replacements[3] = sprintf("%02d", $date->year % 100);
$replacements[2] = sprintf("%02d", $date->hour);
$replacements[1] = sprintf("%02d", $date->minute);
$replacements[0] = sprintf("%02d", $date->second);
echo preg_replace($patterns, $replacements, $format);
}
开发者ID:reekoheek,项目名称:php-fw,代码行数:19,代码来源:Format.php
示例16: init
public function init()
{
$callbacksData = filter_input(INPUT_POST, 'Callbacks', FILTER_REQUIRE_ARRAY);
if (!empty($callbacksData)) {
$callback = new \Callbacks\Callback();
$error = false;
if (empty($callbacksData['text'])) {
$error = true;
Msg::add('Вы не написали текст отзыва');
} else {
$callback->text = nl2br(htmlspecialchars($callbacksData['text']));
}
if (empty($callbacksData['name'])) {
$error = true;
Msg::add('Вы не указали свое имя');
} else {
$callback->name = htmlspecialchars($callbacksData['name']);
}
if (empty($callbacksData['phone'])) {
$error = true;
Msg::add('Вы не указали свой номер телефона');
} else {
$callback->phone = htmlspecialchars($callbacksData['phone']);
}
$files = filter_var($_FILES['Callbacks'], FILTER_REQUIRE_ARRAY);
if (!empty($files['tmp_name']['photo'])) {
$callback->image_file_id = App::$cur->files->upload(['name' => $files['name']['photo'], 'tmp_name' => $files['tmp_name']['photo']]);
}
$callback->mail = htmlspecialchars($callbacksData['mail']);
$callback->type_id = (int) $callbacksData['type'];
if (!$error) {
$callback->save();
if (!empty(App::$cur->config['site']['email'])) {
$subject = 'Новый отзыв';
$text = 'Вы можете его посмотреть по этому адресу: <a href = "http://' . idn_to_utf8(INJI_DOMAIN_NAME) . '/admin/callbacks">http://' . idn_to_utf8(INJI_DOMAIN_NAME) . '/admin/callbacks</a>';
Tools::sendMail('noreply@' . INJI_DOMAIN_NAME, App::$cur->config['site']['email'], $subject, $text);
}
Tools::redirect('/', 'Ваш отзыв был получен и появится после обработки администратором', 'success');
}
}
}
开发者ID:krvd,项目名称:cms-Inji,代码行数:41,代码来源:Callbacks.php
示例17: _getApiTicket
/**
* @descrpition 从微信服务器获取微信API_TICKET
* @return Ambigous|bool
*/
private static function _getApiTicket(){
$accessToken = AccessToken::getAccessToken(true);
$url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token=$accessToken";
$apiTicket = Curl::callWebServer($url, '', 'GET');
if(!isset($apiTicket['ticket'])){
return Msg::returnErrMsg(MsgConstant::ERROR_GET_API_TICKET, '获取API_TICKET失败');
}
$apiTicket['time'] = time();
$apiTicketJson = json_encode($apiTicket);
//存入数据库
/**
* 这里通常我会把api_ticket存起来,然后用的时候读取,判断是否过期,如果过期就重新调用此方法获取,存取操作请自行完成
*
* 请将变量$apiTicketJson给存起来,这个变量是一个字符串
*/
$f = fopen(self::_fileName2Store(), 'w+');
fwrite($f, $apiTicketJson);
fclose($f);
return $apiTicket;
}
开发者ID:jianhua1982,项目名称:LaneWeChat,代码行数:25,代码来源:apiticket.lib.php
示例18: elseif
} elseif ($year) {
LogStats::monthly($table, $year);
} else {
LogStats::yearly($table);
}
if ($table == 'record') {
include_once "../model/Query/Page/Record.php";
$logQ = new Query_Page_Record();
} else {
include_once "../model/Query/Page/Access.php";
$logQ = new Query_Page_Access();
$profiles = array(OPEN_PROFILE_ADMINISTRATOR => _("Administrator"), OPEN_PROFILE_ADMINISTRATIVE => _("Administrative"), OPEN_PROFILE_DOCTOR => _("Doctor"));
}
if (!$logQ->select($year, $month, $day)) {
$logQ->close();
echo Msg::info(_("No logs in this date."));
include_once "../layout/footer.php";
exit;
}
$thead = array(_("#"), _("Access Date"), _("Login"));
if ($table == 'record') {
$thead[] = _("Table");
$thead[] = _("Operation");
$thead[] = _("Data");
} else {
$thead[] = _("Profile");
}
$options = array('align' => 'center', 0 => array('align' => 'right'));
$tbody = array();
for ($i = 1; $log = $logQ->fetch(); $i++) {
$row = $i . '.';
开发者ID:edubort,项目名称:openclinic-1,代码行数:31,代码来源:log_list.php
示例19: getMsg0
/**
* @return \yii\db\ActiveQuery
*/
public function getMsg0()
{
return $this->hasOne(Msg::className(), ['id' => 'msg']);
}
开发者ID:Acker2015,项目名称:CustomizeLife,代码行数:7,代码来源:CollectInteract.php
示例20: intval
* Retrieving get vars
*/
$idMember = intval($_GET["id_member"]);
$surname1 = Check::safeText($_GET["surname1"]);
$surname2 = Check::safeText($_GET["surname2"]);
$firstName = Check::safeText($_GET["first_name"]);
/**
* Show page
*/
$title = _("Delete Staff Member");
require_once "../layout/header.php";
/**
* Breadcrumb
*/
$links = array(_("Admin") => "../admin/index.php", _("Staff Members") => $returnLocation, $title => "");
echo HTML::breadcrumb($links, "icon icon_staff");
unset($links);
/**
* Form
*/
echo HTML::start('form', array('method' => 'post', 'action' => '../admin/staff_del.php'));
$tbody = array();
$tbody[] = Msg::warning(sprintf(_("Are you sure you want to delete staff member, %s %s %s?"), $firstName, $surname1, $surname2));
$tbody[] = Form::hidden("id_member", $idMember);
$tfoot = array(Form::button("delete", _("Delete")) . Form::generateToken());
$options = array('class' => 'center');
echo Form::fieldset($title, $tbody, $tfoot, $options);
echo HTML::end('form');
echo Msg::hint('* ' . _("Note: The del function will delete the related user too (if exists)."));
echo HTML::para(HTML::link(_("Return"), $returnLocation));
require_once "../layout/footer.php";
开发者ID:edubort,项目名称:openclinic-1,代码行数:31,代码来源:staff_del_confirm.php
注:本文中的Msg类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论