本文整理汇总了PHP中ilUtil::sendFailure方法的典型用法代码示例。如果您正苦于以下问题:PHP ilUtil::sendFailure方法的具体用法?PHP ilUtil::sendFailure怎么用?PHP ilUtil::sendFailure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilUtil
的用法示例。
在下文中一共展示了ilUtil::sendFailure方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleCode
/**
* Handle target parameter
* @param object $a_target
* @return
*/
public static function handleCode($a_ref_id, $a_type, $a_code)
{
global $lng, $tree, $ilUser;
include_once './Services/Link/classes/class.ilLink.php';
$lng->loadLanguageModule($a_type);
try {
self::useCode($a_code, $a_ref_id);
$title = ilObject::_lookupTitle(ilObject::_lookupObjectId($a_ref_id));
ilUtil::sendSuccess(sprintf($lng->txt($a_type . "_admission_link_success_registration"), $title), true);
ilUtil::redirect(ilLink::_getLink($a_ref_id));
} catch (ilMembershipRegistrationException $e) {
switch ($e->getCode()) {
case 124:
//added to waiting list
ilUtil::sendSuccess($e->getMessage(), true);
break;
case 123:
//object is full
ilUtil::sendFailure($lng->txt($a_type . "_admission_link_failure_membership_limited"), true);
break;
case 789:
//out of registration period
ilUtil::sendFailure($lng->txt($a_type . "_admission_link_failure_registration_period"), true);
break;
default:
ilUtil::sendFailure($e->getMessage(), true);
break;
}
$GLOBALS['ilLog']->logStack();
$GLOBALS['ilLog']->write($e->getCode() . ': ' . $e->getMessage());
$parent_id = $tree->getParentId($a_ref_id);
ilUtil::redirect(ilLink::_getLink($parent_id));
}
}
示例2: save
/**
* create new instance and save it
*/
public function save()
{
global $ilUser;
$lm_id = $_REQUEST["lm_id"];
if ($lm_id) {
include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
$type = ilObjSAHSLearningModule::_lookupSubType($lm_id);
if ($type == "scorm") {
include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php";
$lm = new ilObjSCORMLearningModule($lm_id, false);
} else {
include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php";
$lm = new ilObjSCORM2004LearningModule($lm_id, false);
}
include_once "Modules/ScormAicc/classes/Verification/class.ilObjSCORMVerification.php";
$newObj = ilObjSCORMVerification::createFromSCORMLM($lm, $ilUser->getId());
if ($newObj) {
$parent_id = $this->node_id;
$this->node_id = null;
$this->putObjectInTree($newObj, $parent_id);
$this->afterSave($newObj);
} else {
ilUtil::sendFailure($this->lng->txt("msg_failed"));
}
} else {
ilUtil::sendFailure($this->lng->txt("select_one"));
}
$this->create();
}
示例3: saveSettings
/**
* Saves settings fetched from $_POST
*/
public function saveSettings()
{
/**
* @var $ilCtrl ilCtrl
* @var $lng ilLanguage
*/
global $ilCtrl, $lng;
require_once 'Modules/Chatroom/classes/class.ilChatroomFormFactory.php';
$factory = new ilChatroomFormFactory();
$form = $factory->getGeneralSettingsForm();
if (!$form->checkInput()) {
$form->setValuesByPost();
$this->serversettings($form);
return;
}
if (!$this->checkPrivHosts($form->getInput('priv_hosts'))) {
$form->setValuesByPost();
ilUtil::sendFailure($lng->txt('invalid_priv_hosts'));
$this->serversettings($form);
return;
}
$settings = array('protocol' => $form->getInput('protocol'), 'instance' => $form->getInput('instance'), 'port' => $form->getInput('port'), 'address' => $form->getInput('address'), 'priv_hosts' => $form->getInput('priv_hosts'), 'keystore' => $form->getInput('keystore'), 'keypass' => $form->getInput('keypass'), 'storepass' => $form->getInput('storepass'));
require_once 'Modules/Chatroom/classes/class.ilChatroomAdmin.php';
$adminSettings = new ilChatroomAdmin($this->gui->object->getId());
$adminSettings->saveGeneralSettings((object) $settings);
$this->writeDataToFile($settings);
ilUtil::sendSuccess($lng->txt('settings_has_been_saved'), true);
$ilCtrl->redirect($this->gui, 'view-serversettings');
}
示例4: addAdministratorRole
public function addAdministratorRole($a_usr_id)
{
/**
* @var $rbacreview ilRbacReview
* @var $rbacadmin ilRbacAdmin
* @var $lng $lng
*/
global $rbacreview, $rbacadmin, $lng;
$role_list = $rbacreview->getRoleListByObject($this->getRefId());
if (!$role_list) {
ilUtil::sendFailure($lng->txt('missing_rolelist'));
return false;
}
$a_rol_id = null;
foreach ($role_list as $role) {
if (strpos($role['title'], 'il_xavc_admin') !== false) {
$a_rol_id = $role['obj_id'];
break;
}
}
if ((int) $a_rol_id) {
$rbacadmin->assignUser($a_rol_id, $a_usr_id);
return true;
} else {
return false;
}
}
示例5: constraintsAddObject
/**
* Add a precondition for a survey question or question block
*/
public function constraintsAddObject()
{
if (strlen($_POST["v"]) == 0) {
ilUtil::sendFailure($this->lng->txt("msg_enter_value_for_valid_constraint"));
return $this->constraintStep3Object();
}
$survey_questions =& $this->object->getSurveyQuestions();
$structure =& $_SESSION["constraintstructure"];
$include_elements = $_SESSION["includeElements"];
foreach ($include_elements as $elementCounter) {
if (is_array($structure[$elementCounter])) {
if (strlen($_GET["precondition"])) {
$this->object->updateConstraint($_GET['precondition'], $_POST["q"], $_POST["r"], $_POST["v"], $_POST['c']);
} else {
$constraint_id = $this->object->addConstraint($_POST["q"], $_POST["r"], $_POST["v"], $_POST['c']);
foreach ($structure[$elementCounter] as $key => $question_id) {
$this->object->addConstraintToQuestion($question_id, $constraint_id);
}
}
if (count($structure[$elementCounter]) > 1) {
$this->object->updateConjunctionForQuestions($structure[$elementCounter], $_POST['c']);
}
}
}
unset($_SESSION["includeElements"]);
unset($_SESSION["constraintstructure"]);
$this->ctrl->redirect($this, "constraints");
}
示例6: changeOwner
function changeOwner()
{
global $rbacsystem, $ilObjDataCache;
if (!($user_id = ilObjUser::_lookupId($_POST['owner']))) {
ilUtil::sendFailure($this->lng->txt('user_not_known'));
$this->owner();
return true;
}
// no need to change?
if ($user_id != $this->gui_obj->object->getOwner()) {
$this->gui_obj->object->setOwner($user_id);
$this->gui_obj->object->updateOwner();
$ilObjDataCache->deleteCachedEntry($this->gui_obj->object->getId());
include_once "Services/AccessControl/classes/class.ilRbacLog.php";
if (ilRbacLog::isActive()) {
ilRbacLog::add(ilRbacLog::CHANGE_OWNER, $this->gui_obj->object->getRefId(), array($user_id));
}
}
ilUtil::sendSuccess($this->lng->txt('owner_updated'), true);
if (!$rbacsystem->checkAccess("edit_permission", $this->gui_obj->object->getRefId())) {
$this->ctrl->redirect($this->gui_obj);
return true;
}
$this->ctrl->redirect($this, 'owner');
return true;
}
示例7: executeCommand
public function executeCommand()
{
/**
* @var $ilCtrl ilCtrl
* @var $ilTabs ilTabsGUI
* @var $lng ilLanguage
*/
global $ilCtrl, $ilTabs, $lng;
if (!$this->object->getHighscoreEnabled()) {
ilUtil::sendFailure($lng->txt('permission_denied'), true);
$ilCtrl->redirectByClass('ilObjTestGUI');
}
$ilTabs->activateTab('info_short');
$ilTabs->addSubTabTarget('toplist_by_score', $ilCtrl->getLinkTarget($this, 'showResultsToplistByScore'), array('outResultsToplist', 'showResultsToplistByScore'));
$ilTabs->addSubTabTarget('toplist_by_time', $ilCtrl->getLinkTarget($this, 'showResultsToplistByTime'), array('showResultsToplistByTime'));
$cmd = $ilCtrl->getCmd();
$ilCtrl->saveParameter($this, 'active_id');
switch ($cmd) {
case 'showResultsToplistByScore':
$ilTabs->setSubTabActive('toplist_by_score');
$this->showResultsToplistByScore();
break;
case 'showResultsToplistByTime':
$ilTabs->setSubTabActive('toplist_by_time');
$this->showResultsToplistByTime();
break;
default:
$this->showResultsToplistByScore();
}
}
示例8: doCreate
public function doCreate()
{
global $ilLog;
$message = "Standard fields cannot be written to DB";
ilUtil::sendFailure($message);
$ilLog->write("[ilDataCollectionStandardField] " . $message);
}
示例9: newFileItem
/**
* insert new file item
*/
function newFileItem()
{
global $lng;
if ($_FILES["file"]["name"] == "") {
$_GET["subCmd"] = "-";
ilUtil::sendFailure($lng->txt("upload_error_file_not_found"));
return false;
}
include_once "./Modules/File/classes/class.ilObjFile.php";
$fileObj = new ilObjFile();
$fileObj->setType("file");
$fileObj->setTitle($_FILES["file"]["name"]);
$fileObj->setDescription("");
$fileObj->setFileName($_FILES["file"]["name"]);
$fileObj->setFileType($_FILES["file"]["type"]);
$fileObj->setFileSize($_FILES["file"]["size"]);
$fileObj->setMode("filelist");
$fileObj->create();
$fileObj->raiseUploadError(false);
// upload file to filesystem
$fileObj->createDirectory();
$fileObj->getUploadFile($_FILES["file"]["tmp_name"], $_FILES["file"]["name"]);
$this->file_object =& $fileObj;
return true;
}
示例10: ilObjectStatusGUI
/**
* Constructor
* @access public
*/
function ilObjectStatusGUI(&$a_obj)
{
global $ilUser, $ilCtrl, $ilias, $ilErr, $lng, $rbacreview;
$this->ctrl =& $ilCtrl;
$this->object =& $a_obj;
$this->tpl = new ilTemplate("tpl.info_layout.html", false, false, "Services/AccessControl");
$this->tpl->setVariable("INFO_REMARK_INTERRUPTED", $lng->txt('info_remark_interrupted'));
if (empty($_POST['Fuserid'])) {
$this->user =& $ilUser;
} else {
if ($_POST['Fselect_type'] == "id") {
$this->user = $ilias->obj_factory->getInstanceByObjId($_POST['Fuserid'], false);
} else {
include_once 'Services/User/classes/class.ilObjUser.php';
$user_id = ilObjUser::_lookupId($_POST['Fuserid']);
$this->user = $ilias->obj_factory->getInstanceByObjId($user_id, false);
}
if ($this->user === false or $this->user->getType() != 'usr') {
$this->user =& $ilUser;
ilUtil::sendFailure($lng->txt('info_err_user_not_exist'));
} else {
ilUtil::sendInfo($lng->txt('info_user_view_changed'));
}
}
// get all user roles and all valid roles in scope
$this->user_roles = $rbacreview->assignedRoles($this->user->getId());
$this->global_roles = $rbacreview->getGlobalRoles();
$this->valid_roles = $rbacreview->getParentRoleIds($this->object->getRefId());
$this->assigned_valid_roles = $this->getAssignedValidRoles();
$this->getPermissionInfo();
$this->getRoleAssignmentInfo();
$this->getObjectSummary();
}
示例11: saveEnteredPasswordCmd
private function saveEnteredPasswordCmd()
{
$this->passwordChecker->setUserEnteredPassword($_POST["password"]);
if (!$this->passwordChecker->isUserEnteredPasswordCorrect()) {
ilUtil::sendFailure($this->lng->txt("tst_password_entered_wrong_password"), true);
}
$this->ctrl->redirectByClass($this->getNextCommandClass(), $this->getNextCommandCmd());
}
示例12: __construct
/**
* Constructor
*
* @access public
* @param assQuestion $questionOBJ
* @param ilCtrl $ctrl
* @param ilTabsGUI $tabs
* @param ilLanguage $lng
*/
public function __construct(assQuestion $questionOBJ, ilCtrl $ctrl, ilTabsGUI $tabs, ilLanguage $lng)
{
parent::__construct($questionOBJ, $ctrl, $tabs, $lng);
$this->questionHint = new ilAssQuestionHint();
if (!isset($_GET['hint_id']) || !(int) $_GET['hint_id'] || !$this->questionHint->load((int) $_GET['hint_id'])) {
ilUtil::sendFailure('invalid hint id given: ' . (int) $_GET['hint_id'], true);
$this->ctrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST);
}
}
示例13: save
/**
* Save data to DB
*/
function save()
{
$plugin = $this->object->getPlugin();
$result = $this->writePostData();
if ($result == 1) {
ilUtil::sendFailure($plugin->txt("errorInput"), true);
$this->editQuestion();
} else {
parent::save();
}
}
示例14: show
protected function show()
{
$this->tpl->getStandardTemplate();
global $ilLocator, $ilAccess;
if (!$ilAccess->checkAccess('write', '', $_GET['ref_id'])) {
ilUtil::sendFailure("Access denied!");
return;
}
$this->buildHeader($ilLocator);
$form = $this->buildForm();
$this->tpl->setContent($form->getHTML());
}
开发者ID:any333,项目名称:courseEmailsSubscriptionPlugin,代码行数:12,代码来源:class.ilCourseEmailSubscriptionGUI.php
示例15: __construct
/**
* Constructor
*
* @access public
* @param assQuestion $questionOBJ
* @param ilCtrl $ctrl
* @param ilTabsGUI $tabs
* @param ilLanguage $lng
*/
public function __construct(assQuestion $questionOBJ, ilCtrl $ctrl, ilTabsGUI $tabs, ilLanguage $lng)
{
parent::__construct($questionOBJ, $ctrl, $tabs, $lng);
if (!isset($_GET['feedback_id']) || !(int) $_GET['feedback_id']) {
ilUtil::sendFailure('invalid feedback id given: ' . (int) $_GET['feedback_id'], true);
$this->ctrl->redirectByClass('ilAssQuestionFeedbackEditingGUI', ilAssQuestionFeedbackEditingGUI::CMD_SHOW);
}
if (!isset($_GET['feedback_type']) || !ilAssQuestionFeedback::isValidFeedbackPageObjectType($_GET['feedback_type'])) {
ilUtil::sendFailure('invalid feedback type given: ' . $_GET['feedback_type'], true);
$this->ctrl->redirectByClass('ilAssQuestionFeedbackEditingGUI', ilAssQuestionFeedbackEditingGUI::CMD_SHOW);
}
}