$email = $praticien->_user_email; if (!$email) { CAppUI::js("alert('" . addslashes(CAppUI::tr("alert-praticien_email")) . "')"); CApp::rip(); } $operation->loadRefPlageOp(); $exchange_source = CExchangeSource::get("mediuser-" . CAppUI::$user->_id, "smtp"); $exchange_source->init(); try { $exchange_source->setRecipient($email); // Création du token $token = new CViewAccessToken(); $token->ttl_hours = 24; $token->user_id = $praticien->_id; $token->params = "m=planningOp&a=vw_edit_urgence&operation_id={$operation_id}"; if ($msg = $token->store()) { CAppUI::displayAjaxMsg($msg, UI_MSG_ERROR); } $url = $token->getUrl(); // Lien vers la DHE $subject = CAppUI::conf("reservation subject_mail"); $content = CAppUI::conf("reservation text_mail"); $from = array("[URL]", "[PRATICIEN - NOM]", "[PRATICIEN - PRENOM]", "[DATE INTERVENTION]", "[HEURE INTERVENTION]"); $to = array($url, $praticien->_user_last_name, $praticien->_user_first_name, CMbDT::dateToLocale(CMbDT::date($operation->_datetime_best)), CMbDT::transform($operation->_datetime_best, null, CAppUI::conf("time"))); $subject = str_replace($from, $to, $subject); $exchange_source->setSubject($subject); $content = str_replace($from, $to, $content); $content = nl2br(utf8_encode($content)); $exchange_source->setBody($content); $exchange_source->send(); $operation->envoi_mail = CMbDT::dateTime();
CCanDo::checkRead(); $file = CValue::get("file"); list($module, $view) = explode("/", $file, 2); list($action, $extention) = explode(".", $view); $user = CUser::get(); $params["m"] = $module; $params["raw"] = $action; $params["info"] = 1; // Could be done throw session cookie forwarding too $token = new CViewAccessToken(); $token->_spec->loggable = false; $token->user_id = $user->_id; $token->params = CMbString::toQuery($params); $token->datetime_start = "now"; $token->ttl_hours = 1; $token->store(); $base = CAppUI::conf("base_url"); $url = "{$base}/?token={$token->hash}"; $content = file_get_contents($url); $token->delete(); // Try and get view properties if (null == ($props = json_decode($content))) { CAppUI::stepMessage(UI_MSG_ERROR, "regression_checker-noviewinfo"); return; } CAppUI::stepMessage(UI_MSG_OK, "regression_checker-viewinfo-found"); $plan = CView::sampleCheckPlan($props); // Création du template $smarty = new CSmartyDP(); $smarty->assign("module", $module); $smarty->assign("action", $action);