Пример #1
0
 public function __construct()
 {
     parent::__construct();
     $dbi = new DBInterface();
     $this->strings = KioskClient::getStrings();
     $this->set_position(Gtk::WIN_POS_CENTER);
     $this->set_default_size(300, 200);
     $this->set_resizable(false);
     $this->timeLabel = new GtkLabel($this->strings["timeLeftLabel_begin"] . '0' . $this->strings["timeLeftLabel_end"]);
     $this->set_title($this->strings["windowTitle_begin"] . '0' . $this->strings["windowTitle_end"]);
     $this->logoutButton = new GtkButton($this->strings['logoutButton']);
     $this->pauseButton = new GtkButton($this->strings['pauseButton']);
     $box = new GtkVBox();
     $box->pack_start($this->timeLabel);
     if ($dbi->getSetting('max_pause_time')) {
         $box->pack_start($this->pauseButton);
     }
     $box->pack_start($this->logoutButton);
     #    if ( DEBUG ) {
     #      $this->quitButton = new GtkButton("Quit");
     #      $box->pack_start( $this->quitButton );
     #    }
     #    $this->connect_simple( 'destroy', array('Gtk', 'main_quit') );
     $this->add($box);
 }
Пример #2
0
 public function __construct($user_alert_id = 0)
 {
     parent::__construct('user_alert', $user_alert_id);
     if ($user_alert_id) {
         $this->tag = new Tag($this->tag_id());
     }
 }
Пример #3
0
 public function __construct($legislation_id = 0)
 {
     parent::__construct('legislation', $legislation_id);
     if ($legislation_id) {
         $state = new State($this->region_id());
         $logo = LOGO_PATH . strtolower('state_' . $state->state_abbr() . '_' . $this->current_chamber()) . '.png';
         $location = $state->state_name() . ' State ' . $this->current_chamber();
         list($category_id, $category_name) = Category::legislation_get_category($this->current_location());
         $committee = Category::get_location($this->current_location());
         $this->legislator_ids = $this->get_legislator_ids();
         $legislators = array();
         if (!empty($this->legislator_ids)) {
             foreach ($this->legislator_ids as $id) {
                 $legislators[] = new Legislator($id);
             }
         }
         $this->sponsors = Legislation::get_legislator_data($legislators, $committee);
         $this->bill = $this->_extract_bill_id();
         $this->image = $logo;
         $this->bill_location = $location;
         $this->location_description = $committee;
         $this->category = array('id' => $category_id, 'name' => $category_name);
         $this->status = new Status($this->status_id());
         $this->date_introduced_parts = get_date_parts($this->date_introduced());
         $this->date_heard_parts = get_date_parts($this->date_heard());
         $this->_get_public_opinion();
         $this->comment_data = $this->get_comment_data();
     }
 }
 public function __construct($feedback_id = 0)
 {
     parent::__construct('legislation_feedback', $feedback_id);
     if ($feedback_id) {
         $this->user = new User($this->user_id());
     }
 }
Пример #5
0
 public function __construct($lc_id = 0)
 {
     parent::__construct('category', $lc_id);
     if ($lc_id) {
         $sql = "SELECT COUNT(*) FROM legislation WHERE current_location IN (SELECT lc_category FROM category WHERE lc_parent_id={$lc_id})";
         $l_count = db()->Get_Cell($sql);
         $sql = "SELECT COUNT(*) FROM announcement WHERE category_id={$lc_id}";
         $a_count = db()->Get_Cell($sql);
         $total_count = $l_count = $a_count;
         $this->cat_count($total_count);
     }
 }
Пример #6
0
 public function __construct($sponsor_id = 0)
 {
     parent::__construct('sponsor', $sponsor_id);
     if ($sponsor_id) {
         $region = new Region($this->region_id(), $this->region_type());
         $office = new Office($this->office_id());
         $this->sponsor_id = $sponsor_id;
         $this->office = $this->title();
         $this->full_name = $this->name_first() . ' ' . $this->name_last();
         $this->img_name = $this->image();
         $this->public_image = $this->get_image_src();
         $this->image = $this->get_image_src();
         $this->region = $region->city_name();
     }
 }
Пример #7
0
 public function __construct($legislator_id = 0)
 {
     $title_abbr = array('Senator' => 'Sen.', 'Assemblymember' => 'Asm.');
     parent::__construct('legislator', $legislator_id);
     if ($legislator_id) {
         $dist_number = substr($this->district(), 2, 2);
         $this->id = $this->id();
         $this->img_name = remove_accents(strtolower(fix_name($this->name_last()) . '_' . fix_name($this->name_first()))) . '.jpg';
         $this->image = $this->get_image_src();
         $this->level = $this->state() ? 'State' : '';
         $this->title = $title_abbr[$this->name_title()];
         $this->full_name = $this->name_first() . ' ' . $this->name_last();
         $this->party = substr($this->party(), 0, 1);
         $this->district = $this->state() . '-' . $dist_number;
         $this->full_title = sprintf("%s %s - %s (%s)", $this->level, $this->title, $this->party, $this->district);
         $this->office = $this->name_title();
     }
 }
Пример #8
0
 public function __construct($region_id = 0, $region_type = REGION_CITY)
 {
     if ($region_type == REGION_CITY) {
         parent::__construct('ref_city', $region_id);
         if ($region_id) {
             $this->name($this->city_name());
         }
     } elseif ($region_type == REGION_COUNTY) {
         parent::__construct('ref_county', $region_id);
         if ($region_id) {
             $this->name($this->county_name());
         }
     } elseif ($region_type == REGION_STATE) {
         parent::__construct('ref_state', $region_id);
         if ($region_id) {
             $this->name($this->state_name());
         }
     } elseif ($region_type == REGION_NATION) {
     }
 }
Пример #9
0
 public function __construct($announcement_id = 0, $get_list = false)
 {
     parent::__construct('announcement', $announcement_id);
     if ($get_list === false && $announcement_id) {
         $this->sponsor_ids = $this->get_sponsor_ids();
         $sponsors = array();
         if (!empty($this->sponsor_ids)) {
             foreach ($this->sponsor_ids as $id) {
                 $sponsors[] = new Sponsor($id);
             }
         }
         $this->sponsors = Announcement::get_sponsor_data($sponsors);
         list($category_id, $category_name) = Category::announcement_get_category($this->id());
         $this->category = array('id' => $category_id, 'name' => $category_name);
         $this->status = new Status($this->status_id());
         $this->office = new Office($this->sponsor_id());
         $this->date_beginning_parts = get_date_parts($this->date_beginning());
         $this->date_ending_parts = get_date_parts($this->date_ending());
         $this->calendared_parts = get_date_parts($this->calendared());
         $this->vote_parts = get_date_parts($this->vote());
         $this->_get_public_opinion();
         $this->comment_data = $this->get_comment_data();
     }
 }
Пример #10
0
 /**
  *	Переопределяет родительский метод: задает значение по умолчанию для $key_name как 'SHORT_NAME'
  *
  *	@author Anthony Boutinov
  *	
  *	@param mysqli_result $query_result		Резальтат запроса
  *	@param string $key_name					(Опционально) Название колонки, которую сделать ключевой
  *	@retval array
  */
 protected function keyRowsByColumn($query_result, $key_name = 'SHORT_NAME')
 {
     return parent::keyRowsByColumn($query_result, $key_name);
 }
Пример #11
0
 public function __construct($log_id = 0)
 {
     parent::__construct('log', $log_id);
 }
Пример #12
0
 public function __construct($image_id = 0)
 {
     parent::__construct('ref_image', $image_id);
 }
Пример #13
0
<?php

/*
This file is used to update everything that can be updated in the personal view
*/
session_start();
include_once "basic.php";
if (checkClearanceLevel(ORGANIZER)) {
    $permission = true;
} else {
    $permission = false;
}
if ($permission == true) {
    include "DBInterface.php";
    $dbConn = new DBInterface();
    switch ($_POST['toUpdate']) {
        case 'allocated_time':
            $data = array("allocated_time" => $_POST['newValue']);
            $dbConn->updateEmployment($_POST['personID'], $_POST['year'], $data);
            echo date("Y-m-d H:i:s");
            break;
        case 'extra_hours':
            $data = array("hours" => $_POST['newValue']);
            $dbConn->updateHoursExtra($_POST['id'], $data);
            echo date("Y-m-d H:i:s");
            break;
        case 'extra_note':
            $data = array("description" => $_POST['newValue']);
            $dbConn->updateHoursExtra($_POST['id'], $data);
            echo date("Y-m-d H:i:s");
            break;
Пример #14
0
<?php

session_start();
include_once "basic.php";
if (checkClearanceLevel(ORGANIZER)) {
    include_once "dbcredentialspath.php";
    include_once DB_CREDENTIALS_PATH;
    include_once "DBInterface.php";
    /*foreach ($_POST as $test) {
    		echo $test . "\n";
    	}*/
    $dbConn = new DBInterface();
    if (isset($_POST['toUpdate'])) {
        switch ($_POST['toUpdate']) {
            case 'hoursWorkOnCourse':
                $data = array("hours" => $_POST['hours']);
                $hoursWorkForTheCourse = $dbConn->getHoursWorkPerCoursePerPeriod($_POST['coursePerPeriodID']);
                if (isset($hoursWorkForTheCourse[$_POST['personID']])) {
                    if ($_POST['hours'] == -1) {
                        $dbConn->removeHoursWork($_POST['coursePerPeriodID'], $_POST['personID']);
                        exit;
                    }
                    $dbConn->updateHoursWork($_POST['coursePerPeriodID'], $_POST['personID'], $data);
                    $coursePerPeriod = $dbConn->getCoursePerPeriod($_POST['coursePerPeriodID']);
                    $hoursWork = $dbConn->getTotalHoursWork($_POST['personID'], $coursePerPeriod['year']);
                    if ($_POST['mainField'] == "None") {
                        $sumHours = 0;
                        $sumNrOfCourses = 0;
                        foreach ($hoursWork as $mainfield) {
                            $sumHours += $mainfield['hours'];
                            $sumNrOfCourses += $mainfield['nr_of_courses'];
Пример #15
0
<?php

session_start();
include_once "basic.php";
if (checkClearanceLevel(ORGANIZER)) {
    include_once "DBInterface.php";
    $dbConn = new DBInterface();
    $typeName = $dbConn->getTypeName($_POST['typeID']);
    if ($typeName['name'] == "Semester") {
        $data = array("id_person" => $_POST['personID'], "year" => $_POST['year'], "id_type_name" => $_POST['typeID'], "display_area" => "UpperField");
    } else {
        $data = array("id_person" => $_POST['personID'], "year" => $_POST['year'], "id_type_name" => $_POST['typeID'], "display_area" => $_POST['display']);
    }
    $dbConn->createHoursExtra($data);
    echo $typeName['name'];
}
Пример #16
0
 public function checkPasswords()
 {
     if (DEBUG) {
         echo "SetPasswordWindow::checkPasswords()\n";
     }
     $password1 = $this->passwordEntry1->get_text();
     $password2 = $this->passwordEntry2->get_text();
     if (empty($password1)) {
         if (DEBUG) {
             echo "SetPasswordWidnwo::checkPasswords() :: Password Field 1 is Empty!\n";
         }
         $this->passwordEntry1->grab_focus();
     } elseif (empty($password2)) {
         if (DEBUG) {
             echo "SetPasswordWidnwo::checkPasswords() :: Password Field 2 is Empty!\n";
         }
         $this->passwordEntry2->grab_focus();
     } elseif ($password1 != $password2) {
         if (DEBUG) {
             echo "SetPasswordWidnwo::checkPasswords() :: Passwords Do Not Match!\n";
         }
         $this->messageLabel->set_markup($this->strings['passwordsDoNotMatch']);
         $this->passwordEntry1->set_text('');
         $this->passwordEntry2->set_text('');
         $this->passwordEntry1->grab_focus();
     } else {
         ## Passwords match, Huzzah!!!
         if (DEBUG) {
             echo "SetPasswordWidnwo::checkPasswords() :: Passwords Match! Updating Database.\n";
         }
         $db = new DBInterface();
         $db->setPassword($this->username, $password1);
         $this->destroy();
     }
 }
Пример #17
0
 function __destruct()
 {
     parent::__destruct();
 }
Пример #18
0
if (!ob_get_level()) {
    ob_start();
}
define('CLASSES_DIR', dirname(__FILE__) . '/classes/');
define('HTTPS', @$_SERVER['HTTPS'] != '' && @$_SERVER['HTTPS'] != 'off');
define('SERVER_URL', 'http' . (HTTPS ? 's' : '') . '://' . $_SERVER['SERVER_NAME'] . (@$_SERVER['SERVER_PORT'] != (HTTPS ? 443 : 80) ? ':' . $_SERVER['SERVER_PORT'] : '') . (@$_SERVER['PHP_AUTH_USER'] ? '@' . @$_SERVER['PHP_AUTH_USER'] . ':' . @$_SERVER['PHP_AUTH_PW'] : '') . '/');
define('BASE_URL', SERVER_URL . substr(dirname($_SERVER['SCRIPT_NAME']), 1) . '/');
/**
 * Autoloads a class from this folder or a subfolder (if the class is namespaced)
 */
function __autoload($class)
{
    require_once CLASSES_DIR . str_replace("\\", "/", $class) . '.php';
}
// __autoload( $class )
$db = new DBInterface("localhost", "project_tracker", "project_tracker", "project_tracker");
/**
 * Initiates a PHP session if a session ID cookie is found.
 */
if (array_key_exists(session_name(), $_COOKIE)) {
    try {
        session_start();
        $loginSession = $db->readLoginSession($_COOKIE[session_name()]);
    } catch (Exception $ex) {
        // Unable to restore session for some reason
        session_destroy();
        unset($loginSession);
    }
}
function doUnauthorizedRedirect()
{
Пример #19
0
 /**
  * Store a log message -- used by Ledger
  * 
  * @param string $level
  * @param string $message
  * @param string $context (JSON encoded)
  * @return mixed
  */
 public function store(string $level, string $message, string $context)
 {
     return $this->db->insert($this->table, [$this->columns['level'] => $level, $this->columns['message'] => $message, $this->columns['context'] => $context]);
 }
Пример #20
0
 public function __construct($user_region_id = 0)
 {
     parent::__construct('user_region', $user_region_id);
 }
Пример #21
0
 public function __construct($sms_id = 0)
 {
     parent::__construct('sms_gateway', $sms_id);
 }
Пример #22
0
 public function __construct($status_id = 0)
 {
     parent::__construct('status', $status_id);
 }
Пример #23
0
 public function __construct($office_id = 0)
 {
     parent::__construct('ref_office', $office_id);
 }
Пример #24
0
 public function __construct($state_id = 0)
 {
     parent::__construct('ref_state', $state_id);
 }
Пример #25
0
 /**
  * This was added to simplify the front-end code for building an array of objects when all of a particular table type for an id are requested.
  * i.e. to retrieve all videos
  */
 public static function fetchAll($table, $key = null, $id = 0)
 {
     $db_interface = new DBInterface($table);
     return $db_interface->_fetchAll($key, $id);
 }
Пример #26
0
<?php

include "basic.php";
include "DBInterface.php";
session_start();
if (isset($_SESSION["user_name"])) {
    $dbConn = new DBInterface();
    $dbConn->logOff($_SESSION["user_name"]);
    $_SESSION["user_name"] = null;
    $_SESSION["user_password"] = null;
    setcookie("user_name", "", time() - 3600);
    setcookie("user_authkey", "", time() - 3600);
}
session_destroy();
header('Location: index.php');
Пример #27
0
 public function __construct($admin_id = 0)
 {
     parent::__construct('user', $admin_id);
 }
Пример #28
0
 public function __construct($tag_id = 0)
 {
     parent::__construct('tag', $tag_id);
     if ($tag_id) {
     }
 }
Пример #29
0
 public function __construct($tf_id = 0)
 {
     parent::__construct('tell_friend', $tf_id);
 }