Example #1
0
function plugin_init_surveyticket()
{
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['csrf_compliant']['surveyticket'] = true;
    if (isset($_SESSION["glpiID"])) {
        $plugin = new Plugin();
        if ($plugin->isActivated('surveyticket')) {
            Plugin::registerClass('PluginSurveyticketProfile', array('addtabon' => array('Profile')));
            $PLUGIN_HOOKS['change_profile']['surveyticket'] = array('PluginSurveyticketProfile', 'changeprofile');
            PluginSurveyticketProfile::changeprofile();
            if (PluginSurveyticketProfile::haveRight("config", 'r')) {
                $PLUGIN_HOOKS['menu_entry']['surveyticket'] = true;
                $PLUGIN_HOOKS['config_page']['surveyticket'] = 'front/menu.php';
            }
            $PLUGIN_HOOKS['post_init']['surveyticket'] = 'plugin_surveyticket_post_init';
        }
        // Icons add, search...
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['add']['questions'] = 'front/question.form.php?add=1';
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['search']['questions'] = 'front/question.php';
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['add']['survey'] = 'front/survey.form.php?add=1';
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['search']['survey'] = 'front/survey.php';
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['add']['answers'] = 'front/answer.form.php?add=1';
        // Fil ariane
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['options']['questions']['title'] = "Questions";
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['options']['questions']['page'] = '/plugins/surveyticket/front/question.php';
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['options']['answers']['title'] = "Answers";
        //         $PLUGIN_HOOKS['submenu_entry']['surveyticket']['options']['answers']['page']  = '/plugins/surveyticket/front/answer.php';
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['options']['survey']['title'] = "Surveys";
        $PLUGIN_HOOKS['submenu_entry']['surveyticket']['options']['survey']['page'] = '/plugins/surveyticket/front/survey.php';
    }
}
Example #2
0
function plugin_surveyticket_install()
{
    global $DB;
    if (!TableExists('glpi_plugin_surveyticket_questions')) {
        $DB_file = GLPI_ROOT . "/plugins/surveyticket/install/mysql/plugin_surveyticket-empty.sql";
        $DBf_handle = fopen($DB_file, "rt");
        $sql_query = fread($DBf_handle, filesize($DB_file));
        fclose($DBf_handle);
        foreach (explode(";\n", "{$sql_query}") as $sql_line) {
            if (Toolbox::get_magic_quotes_runtime()) {
                $sql_line = Toolbox::stripslashes_deep($sql_line);
            }
            if (!empty($sql_line)) {
                $DB->query($sql_line);
            }
        }
        include GLPI_ROOT . "/plugins/surveyticket/inc/profile.class.php";
        $psProfile = new PluginSurveyticketProfile();
        $psProfile->initProfile();
    }
    return true;
}
Example #3
0
 static function checkRight($module, $right)
 {
     global $CFG_GLPI;
     if (!PluginSurveyticketProfile::haveRight($module, $right)) {
         // Gestion timeout session
         if (!Session::getLoginUserID()) {
             Html::redirect($CFG_GLPI["root_doc"] . "/index.php");
             exit;
         }
         Html::displayRightError();
     }
 }
Example #4
0
 static function canView()
 {
     return PluginSurveyticketProfile::haveRight("config", 'r');
 }
Example #5
0
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  GNU Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with Surveyticket plugin. If not, see <http://www.gnu.org/licenses/>.

  ------------------------------------------------------------------------

  @package   Surveyticket plugin
  @author    David Durieux
  @copyright Copyright (c) 2012-2013 Surveyticket plugin team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      https://forge.indepnet.net/projects/surveyticket
  @since     2012

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Session::checkRight("profile", "r");
$psProfile = new PluginSurveyticketProfile();
Session::checkRight("profile", "w");
if ($psProfile->getFromDB($_POST['profiles_id'])) {
    $psProfile->update($_POST);
    $psProfile->changeprofile();
    Html::back();
} else {
    $psProfile->add($_POST);
    $psProfile->changeprofile();
    Html::back();
}