Location: PHPKode > projects > ProjectButler > ProjectButler/menu/php/menuentry.php
<?php

    $offset = "../../includes/";

    require_once($offset."class.menu.inc");
    require_once($offset."class.user_group.inc");


    if (PM_Common::check_login($system_user_id, $system_user_group_id ) != $secure_check) {
      $error = new Error_Management;
      $error->error_page(1);
      die();
    }

    if ($system_user_group_id != 1)  {
       $error = new Error_Management;
       $error->error_page(1);
       die();
    }
    
    if (strcmp($action,'update') == 0) {
       $menu_array = new Menu;
       $menu_list =$menu_array->get_menu($selected_menu_id);
       $menu_id = $menu_list->menu_id;
       $user_group_id = $menu_list->user_group_id;
       $topic =$menu_list->topic;
       $path = $menu_list->path;
       $status = $menu_list->status;
    }
    $user_group = new User_Group;
    $user_group_array=$user_group->get_user_groups();
    for($i=1; $i <= count($user_group_array); $i++) {
      $user_group_list=$user_group_array[$i];
      $user_group_id_list[$i]=$user_group_list->user_group_id;
      $user_group_name_list[$i] = $user_group_list->user_group_name;
    }
    
    if (!isset($status)) {
       $status="A";
    }

    if (strcmp($action,'add') == 0) {
      $menu = new Menu();
      $menu->user_group_id = $user_group_id;
      $menu->topic = $topic;
      $menu->path = $path;
      $menu->status = $status;
      $check_message = $menu->check_params($menu, $system_user_id);
      if (strcmp($check_message,"") == 0) {
        if ($user_group_id==0) {
           for($i=1; $i <= count($user_group_array); $i++) {
             $menu->user_group_id = $user_group_id_list[$i];
             $new_menu_id=$menu->new_menu($menu, $system_user_id);
             if ($new_menu_id < 1) {
               $error = new Error_Management;
               $error->error_page(102);
               die();
             }
           }
        } else {
          $new_menu_id=$menu->new_menu($menu, $system_user_id);
          if ($new_menu_id < 1) {
            $error = new Error_Management;
            $error->error_page(102);
            die();
          }
        }
      }
    }

    if (strcmp($action,'edit') == 0) {
      $menu = new Menu();
      $menu->menu_id = $selected_menu_id;
      $menu->user_group_id = $user_group_id;
      $menu->topic = $topic;
      $menu->path = $path;
      $menu->status = $status;
      $check_message = $menu->check_params($menu, $system_user_id);
      if (strcmp($check_message,"") == 0) {
        $edit_result=$menu->edit_menu($menu, $system_user_id);
        if ($edit_result != 1) {
          $error = new Error_Management;
          $error->error_page(103);
          die();
        }
      }
    }

    if ((strcmp($action,"add") == 0) && ($new_menu_id > 0) || (strcmp($action,"edit") == 0) && ($edit_result > 0)) {
      Header("Location: ../templates/show_menu_list_tmpl.php");
    }

    if (($edit_result>0) || ($new_menu_id > 0))  {
      echo "<script language='JavaScript'>\n";
      echo "parent.menu.location.reload();\n";
      echo "</script>";
    }


?>


Return current item: ProjectButler