当前位置: 首页>>代码示例>>PHP>>正文


PHP Session::addMessageAfterRedirect方法代码示例

本文整理汇总了PHP中Session::addMessageAfterRedirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::addMessageAfterRedirect方法的具体用法?PHP Session::addMessageAfterRedirect怎么用?PHP Session::addMessageAfterRedirect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Session的用法示例。


在下文中一共展示了Session::addMessageAfterRedirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isValid

 public function isValid($value)
 {
     if (!parent::isValid($value)) {
         return false;
     }
     // Not a number
     if (!empty($value) && !is_numeric($value)) {
         Session::addMessageAfterRedirect(__('This is not a number:', 'formcreator') . ' ' . $this->fields['name'], false, ERROR);
         return false;
         // Min range not set or text length longer than min length
     } elseif (!empty($this->fields['range_min']) && $value < $this->fields['range_min']) {
         $message = sprintf(__('The following number must be greater than %d:', 'formcreator'), $this->fields['range_min']);
         Session::addMessageAfterRedirect($message . ' ' . $this->fields['name'], false, ERROR);
         return false;
         // Max range not set or text length shorter than max length
     } elseif (!empty($this->fields['range_max']) && $value > $this->fields['range_max']) {
         $message = sprintf(__('The following number must be lower than %d:', 'formcreator'), $this->fields['range_max']);
         Session::addMessageAfterRedirect($message . ' ' . $this->fields['name'], false, ERROR);
         return false;
         // Specific format not set or well match
     } elseif (!empty($this->fields['regex']) && !preg_match($this->fields['regex'], $value)) {
         Session::addMessageAfterRedirect(__('Specific format does not match:', 'formcreator') . ' ' . $this->fields['name'], false, ERROR);
         return false;
         // All is OK
     } else {
         return true;
     }
 }
开发者ID:ChristopheG77,项目名称:formcreator,代码行数:28,代码来源:float-field.class.php

示例2: plugin_fields_uninstall

/**
 * Plugin uninstall process
 *
 * @return boolean
 */
function plugin_fields_uninstall()
{
    global $DB;
    if (!class_exists('PluginFieldsProfile')) {
        Session::addMessageAfterRedirect(__("The plugin can't be uninstalled when the plugin is disabled", 'fields'), true, WARNING, true);
        return false;
    }
    $_SESSION['uninstall_fields'] = true;
    echo "<center>";
    echo "<table class='tab_cadre_fixe'>";
    echo "<tr><th>" . __("MySQL tables uninstallation", "fields") . "<th></tr>";
    echo "<tr class='tab_bg_1'>";
    echo "<td align='center'>";
    $classesToUninstall = array('PluginFieldsDropdown', 'PluginFieldsContainer', 'PluginFieldsContainer_Field', 'PluginFieldsLabelTranslation', 'PluginFieldsField', 'PluginFieldsValue', 'PluginFieldsProfile', 'PluginFieldsMigration');
    foreach ($classesToUninstall as $class) {
        if ($plug = isPluginItemType($class)) {
            $dir = GLPI_ROOT . "/plugins/fields/inc/";
            $item = strtolower($plug['class']);
            if (file_exists("{$dir}{$item}.class.php")) {
                include_once "{$dir}{$item}.class.php";
                if (!call_user_func(array($class, 'uninstall'))) {
                    return false;
                }
            }
        }
    }
    echo "</td>";
    echo "</tr>";
    echo "</table></center>";
    unset($_SESSION['uninstall_fields']);
    // clean display preferences
    $DB->query("DELETE FROM glpi_displaypreferences WHERE itemtype LIKE 'PluginFields%'");
    return true;
}
开发者ID:pluginsGLPI,项目名称:fields,代码行数:39,代码来源:hook.php

示例3: beforeUpdate

 static function beforeUpdate(Problem $problem)
 {
     if (!is_array($problem->input) || !count($problem->input)) {
         // Already cancel by another plugin
         return false;
     }
     //    Toolbox::logDebug("PluginBehaviorsProblem::beforeUpdate(), Problem=", $problem);
     $config = PluginBehaviorsConfig::getInstance();
     // Check is the connected user is a tech
     if (!is_numeric(Session::getLoginUserID(false)) || !Session::haveRight('problem', UPDATE)) {
         return false;
         // No check
     }
     $soltyp = isset($problem->input['solutiontypes_id']) ? $problem->input['solutiontypes_id'] : $problem->fields['solutiontypes_id'];
     // Wand to solve/close the problem
     if (isset($problem->input['solutiontypes_id']) && $problem->input['solutiontypes_id'] || isset($problem->input['solution']) && $problem->input['solution'] || isset($problem->input['status']) && in_array($problem->input['status'], array_merge(Problem::getSolvedStatusArray(), Problem::getClosedStatusArray()))) {
         if ($config->getField('is_problemsolutiontype_mandatory')) {
             if (!$soltyp) {
                 unset($problem->input['status']);
                 unset($problem->input['solution']);
                 unset($problem->input['solutiontypes_id']);
                 Session::addMessageAfterRedirect(__('You cannot close a problem without solution type', 'behaviors'), true, ERROR);
             }
         }
     }
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:26,代码来源:problem.class.php

示例4: isValid

 public function isValid($value)
 {
     $value = json_decode($value);
     if (is_null($value)) {
         $value = array();
     }
     // If the field is required it can't be empty
     if ($this->isRequired() && empty($value)) {
         Session::addMessageAfterRedirect(__('A required field is empty:', 'formcreator') . ' ' . $this->getLabel(), false, ERROR);
         return false;
         // Min range not set or number of selected item lower than min
     } elseif (!empty($this->fields['range_min']) && count($value) < $this->fields['range_min']) {
         $message = sprintf(__('The following question needs of at least %d answers', 'formcreator'), $this->fields['range_min']);
         Session::addMessageAfterRedirect($message . ' ' . $this->getLabel(), false, ERROR);
         return false;
         // Max range not set or number of selected item greater than max
     } elseif (!empty($this->fields['range_max']) && count($value) > $this->fields['range_max']) {
         $message = sprintf(__('The following question does not accept more than %d answers', 'formcreator'), $this->fields['range_max']);
         Session::addMessageAfterRedirect($message . ' ' . $this->getLabel(), false, ERROR);
         return false;
         // All is OK
     } else {
         return true;
     }
 }
开发者ID:ChristopheG77,项目名称:formcreator,代码行数:25,代码来源:checkboxes-field.class.php

示例5: prepareInputForAdd

 public function prepareInputForAdd($input)
 {
     if (!isset($input["number"]) || $input["number"] == '') {
         Session::addMessageAfterRedirect(__("A bill number is mandatory", "order"), false, ERROR);
         return array();
     }
     return $input;
 }
开发者ID:korial29,项目名称:order,代码行数:8,代码来源:bill.class.php

示例6: prepareInputForUpdate

 /**
  * allow to control data before updating in bdd
  *
  * @param datas $input
  * @return array|datas|the
  */
 function prepareInputForUpdate($input)
 {
     if (!isset($input["plugin_resources_professions_id"]) || $input["plugin_resources_professions_id"] == '0') {
         Session::addMessageAfterRedirect(__('The profession for the budget must be filled', 'resources'), false, ERROR);
         return array();
     }
     return $input;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:14,代码来源:budget.class.php

示例7: prepareInputForAdd

 function prepareInputForAdd($input)
 {
     global $CFG_GLPI, $LANG;
     if (empty($input['name'])) {
         Session::addMessageAfterRedirect($LANG['plugin_formcreator']["error_form"][5], false, ERROR);
         return false;
     }
     return $input;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:9,代码来源:cat.class.php

示例8: pre_deleteItem

 function pre_deleteItem()
 {
     if ($this->getID() <= self::CANCELED) {
         Session::addMessageAfterRedirect(__("You cannot remove this status", "order") . ": " . $this->fields['name'], false, ERROR);
         return false;
     } else {
         return true;
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:9,代码来源:orderstate.class.php

示例9: plugin_news_uninstall

function plugin_news_uninstall()
{
    if (!PluginNewsAlert::dropTable() || !PluginNewsProfile::dropTable()) {
        Session::addMessageAfterRedirect('Uninstallation failed');
        return false;
    }
    PluginNewsProfile::uninstallProfile();
    return true;
}
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:9,代码来源:hook.php

示例10: prepareInputForAdd

 function prepareInputForAdd($input)
 {
     // TODO: check if the entities should not be inherited from the profile or the user
     if (!isset($input['entities_id']) || $input['entities_id'] < 0) {
         Session::addMessageAfterRedirect(__('No selected element or badly defined operation'), false, ERROR);
         return false;
     }
     return parent::prepareInputForAdd($input);
 }
开发者ID:Ixertec,项目名称:glpi,代码行数:9,代码来源:profile_user.class.php

示例11: prepareInputForAdd

 function prepareInputForAdd($input)
 {
     // Check override of segment : do not add
     if (count(self::getSegmentsBetween($input['calendars_id'], $input['day'], $input['begin'], $input['day'], $input['end'])) > 0) {
         Session::addMessageAfterRedirect(__('Can not add a range riding an existing period'), false, ERROR);
         return false;
     }
     return parent::prepareInputForAdd($input);
 }
开发者ID:kipman,项目名称:glpi,代码行数:9,代码来源:calendarsegment.class.php

示例12: prepareInputForAdd

 function prepareInputForAdd($input)
 {
     global $CFG_GLPI;
     if (empty($input['name'])) {
         Session::addMessageAfterRedirect(__('Tu Ticket Target no tiene Nombre.'), false, ERROR);
         return false;
     }
     return $input;
 }
开发者ID:OscarLoayzaB,项目名称:formcreator,代码行数:9,代码来源:formgroup.class.php

示例13: plugin_databreakdown_install

function plugin_databreakdown_install()
{
    if (!file_exists(c\DOC_DIR)) {
        $ok = mkdir(c\DOC_DIR, 0777, true);
        if (!$ok) {
            $msg = sprintf(p\__("Failed to create the plugin's document directory '%s'"), p\DOC_DIR);
            Session::addMessageAfterRedirect($msg, true, ERROR);
        }
    }
    return true;
}
开发者ID:kiniou,项目名称:glpi-plugin-databreakdown,代码行数:11,代码来源:setup.php

示例14: install

 static function install(Migration $migration)
 {
     //check if "inc", "front" and "ajax" directories are writeable for httpd
     $directories = array("../plugins/fields/inc", "../plugins/fields/front", "../plugins/fields/ajax");
     foreach ($directories as $directory) {
         if (!is_writable($directory)) {
             Session::addMessageAfterRedirect(__("This plugin need write right on his own files, please correct.", 'fields'), false, ERROR);
             return false;
         }
     }
     return true;
 }
开发者ID:publik1974,项目名称:fields,代码行数:12,代码来源:dropdown.class.php

示例15: isValid

 public function isValid($value)
 {
     if (!parent::isValid($value)) {
         return false;
     }
     // Specific format not set or well match
     if (!empty($value) && !filter_var($value, FILTER_VALIDATE_EMAIL)) {
         Session::addMessageAfterRedirect(__('This is not a valid e-mail:', 'formcreator') . ' ' . $this->getLabel(), false, ERROR);
         return false;
     }
     // All is OK
     return true;
 }
开发者ID:ChristopheG77,项目名称:formcreator,代码行数:13,代码来源:email-field.class.php


注:本文中的Session::addMessageAfterRedirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。