Code Search for Developers
 
 
  

global.php from SME Web Application Framework at Krugle


Show global.php syntax highlighted

<?php
/*
This  file is  part of  DT.   DT is  web application  written for  the
Albanian branch of Deloitte & Touche company.

Copyright (C) 2002 Dashamir Hoxha, dashohoxha@users.sf.net

DT is  free software; you can  redistribute it and/or  modify it under
the terms of  the GNU General Public License as  published by the Free
Software  Foundation; either  version 2  of the  License, or  (at your
option) any later version.

DT is distributed in the hope  that it will be useful, but WITHOUT ANY
WARRANTY;  without even  the  implied warranty  of MERCHANTABILITY  or
FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License
for more details.

You  should have received  a copy  of the  GNU General  Public License
along with DT; if not, write to the Free Software Foundation, Inc., 59
Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

/**
 * Functions and variables that are global
 * and are used through the whole application.
 */

/** access right constants */
define("ACCR_VIEW", 1);
define("ACCR_EDIT", 2);
define("ACCR_FINANC", 3);
define("ACCR_SCHEDULE", 4);
define("ACCR_ADMIN", 5);
define("ACCR_SU", 6);

/** project status constants */
define("CONTRACTED", 1);
define("PROPOSAL", 2);
define("QUALIFIED", 3);
define("OPPORTUNITY", 4);

/** staff roles constants */
define("MANAGER", 2);
define("PARTNER", 8);

/**
 * Returns the current date in the requested format.
 */
function get_curr_date($format)
{
  if (TEST) 
    {
      return simulated_date($format);
    }
  else
    {
      return date($format);
    }
}

/**
 * Converts a month number to format MMM, e.g. from 1 to Jan.
 */
function int2mon($m_id)
{
  $mon = date("M", mktime(0,0,0,$m_id,1,2002));
  return $mon;
}

/** 
 * Converts a MMM month format to integer, e.g. from Jan to 1. 
 */
function mon2int($mon)
{
  return date("n", strtotime("$mon 01, 2002"));
}


function simulated_date($format)
{
  $day   = WebApp::getSVar("simulated_current_day");
  $month = WebApp::getSVar("simulated_current_month");
  $year  = WebApp::getSVar("simulated_current_year");

  switch ($format)
    {
    case "Y":
      return $year;
      break;
    case "m":
      return $month;
      break;
    case "M":
      return int2mon($month);
      break;
    case "n":
      return $month;
      break;
    case "d/m/Y":
      return "$day/$month/$year";
      break;
    case "Y-m-d":
      return "$year-$month-$day";
    case "M d, Y":
      return int2mon($month)." $day, $year";
      break;
    }
}
?>



See more files for this project here

SME Web Application Framework

smewebapp intends to simplify the construction of web applications for informatization of the work of SME-s (small and medium enterprises), institutions, organizations etc.

Project homepage: http://sourceforge.net/projects/smewebapp
Programming language(s): JavaScript,PHP,Shell Script,XML
License: other

  config/
    const.DB.php
    const.Debug.php
    const.Options.php
    const.Paths.php
  db/
    DT.sql
    config.sh
    create.sh
    dump.sh
  graphics/
    arrow.gif
    blue_tri.gif
    deloitte.gif
    koka_back.jpg
    pixel.gif
    style.css
  templates/
    administrate/
      editUser/
        accessRights/
          accessRights.db
          accessRights.html
          accessRights.js
        editUser.db
        editUser.html
        editUser.js
        editUser.php
      listOfUsers/
        listOfUsers.db
        listOfUsers.html
        listOfUsers.js
        listOfUsers.php
        list_navigation_bar.html
      selectUsers/
        selectUsers.db
        selectUsers.html
        selectUsers.js
        selectUsers.php
      administrate.html
      administrate.php
    login/
      header.html
      login.html
      login.js
      on.login.php
    mainMenu/
      mainMenu.css
      mainMenu.html
      mainMenu.js
      mainMenu.php
    modify/
      editNSR/
        editNSR.db
        editNSR.html
        editNSR.js
        editNSR.php
        select.html
        select_by_dept.js
      editProject/
        bids/
        deptDistrib/
        editContracted/
        editOpportunity/
        editProposal/
        managers/
        partners/
        projTeam/
        timeDistrib/
        calendar.js
        edit.db
        edit.html
        edit.php
        editProject.db
        editProject.html
        editProject.js
        editProject.php
      projectList/
        projectList.db
        projectList.html
        projectList.js
        projectList.php
        selection.html
        selection.php
      modify.html
      modify.js
      modify.php
      modifyMenu.html
    monitor/
      listOfProjRpt/
      needToSellRpt/
      summaryRpt/
      email.html
      email.php
      monitor.html
      monitor.js
      monitor.php
      monitorMenu.html
      printable.html
    schedule/
      conflicts/
      proj_list/
      proj_schedule/
      report/
      user_proj/
      email.html
      email.php
      printable.html
      schedule.html
      schedule.js
      schedule.php
      scheduleMenu.html
    selectProjects/
      select_by_dept/
      select_by_office/
      select_by_role/
    su/
    test/
    userdata/
    global.js
    header.html
    header.php
    main.db
    main.html
    main.php
  webobjects/
  COPYING
  ToDo.txt
  browse.php
  global.php
  index.php
  init.php
  webapp.php