/**
 * Returns html with Advisor
 *
 * @return string
 */
function PMA_getHtmlForAdvisor()
{
    $output = '<a href="#openAdvisorInstructions">';
    $output .= PMA_Util::getIcon('b_help.png', __('Instructions'));
    $output .= '</a>';
    $output .= '<div id="statustabs_advisor"></div>';
    $output .= '<div id="advisorInstructionsDialog" style="display:none;">';
    $output .= '<p>';
    $output .= __('The Advisor system can provide recommendations ' . 'on server variables by analyzing the server status variables.');
    $output .= '</p>';
    $output .= '<p>';
    $output .= __('Do note however that this system provides recommendations ' . 'based on simple calculations and by rule of thumb which may ' . 'not necessarily apply to your system.');
    $output .= '</p>';
    $output .= '<p>';
    $output .= __('Prior to changing any of the configuration, be sure to know ' . 'what you are changing (by reading the documentation) and how ' . 'to undo the change. Wrong tuning can have a very negative ' . 'effect on performance.');
    $output .= '</p>';
    $output .= '<p>';
    $output .= __('The best way to tune your system would be to change only one ' . 'setting at a time, observe or benchmark your database, and undo ' . 'the change if there was no clearly measurable improvement.');
    $output .= '</p>';
    $output .= '</div>';
    $output .= '<div id="advisorData" style="display:none;">';
    $advisor = new Advisor();
    $output .= htmlspecialchars(json_encode($advisor->run()));
    $output .= '</div>';
    return $output;
}
 public function storeAdvisor()
 {
     // If form validation passes:
     $advisor = new Advisor();
     $advisor->name = Input::get('name');
     $advisor->email = Input::get('email');
     $advisor->password = Hash::make(Input::get('password'));
     $advisor->save();
     Auth::attempt(['email' => $advisor->email, 'password' => Input::get('password')]);
     return Redirect::intended('advisor.dashboard');
 }
Example #3
0
 /**
  * @depends testParse
  * @dataProvider rulesProvider
  */
 public function testAddRule($rule, $expected, $error)
 {
     $advisor = new Advisor();
     $parseResult = $advisor->parseRulesFile();
     $this->assertEquals($parseResult['errors'], array());
     $advisor->variables['value'] = 0;
     $advisor->addRule('fired', $rule);
     if (isset($advisor->runResult['errors']) || !is_null($error)) {
         $this->assertEquals($advisor->runResult['errors'], array($error));
     }
     if (isset($advisor->runResult['fired']) || $expected != array()) {
         $this->assertEquals($advisor->runResult['fired'], array($expected));
     }
 }
Example #4
0
    <div id="login">
      <div id="form">
        <div class="top">
		<?php 
$first = $_POST["firstN"];
$last = $_POST["lastN"];
$office = $_POST["Office"];
$meeting = $_POST["Meeting"];
$user = $_POST["UserN"];
$pass = md5($_POST["PassW"]);
include '../CommonMethods.php';
include '../Advisor.php';
$debug = false;
$Common = new Common($debug);
$userN = $_SESSION["User_ID"];
$adv = new Advisor($Common, $userN);
if ($adv->createAdvisor($Common, $first, $last, $user, $pass, $office, $meeting)) {
    echo "<h3>Advisor {$first} {$last} created successfully</h3>";
} else {
    echo "<h3>Advisor {$first} {$last} already exists</h3>";
}
?>
		<form method="link" action="AdminUI.php">
			<input type="submit" name="next" class="button large go" value="Return to Home">
		</form>
		</div>
		<?php 
include '../Footer.html';
?>
      </div>
    </div>
Example #5
0
        // In case an error happened
        $return['error'] = PMA_DBI_getError();
        PMA_DBI_free_result($result);
        if ($profiling) {
            $return['profiling'] = array();
            $result = PMA_DBI_try_query('SELECT seq,state,duration FROM INFORMATION_SCHEMA.PROFILING WHERE QUERY_ID=1 ORDER BY seq');
            while ($row = PMA_DBI_fetch_assoc($result)) {
                $return['profiling'][] = $row;
            }
            PMA_DBI_free_result($result);
        }
        exit(json_encode($return));
    }
    if (isset($_REQUEST['advisor'])) {
        include 'libraries/Advisor.class.php';
        $advisor = new Advisor();
        exit(json_encode($advisor->run()));
    }
}
/**
 * Replication library
 */
if (PMA_DRIZZLE) {
    $server_master_status = false;
    $server_slave_status = false;
} else {
    include_once './libraries/replication.inc.php';
    include_once './libraries/replication_gui.lib.php';
}
/**
 * JS Includes
Example #6
0
    }
    echo "Appointment: ", date('l, F d, Y g:i A', $oldDatephp), "<br>";
    // Display meeting location
    echo "Meeting Location: ", $appt->getMeeting(), "</label><br>";
    // Hidden input for old appointment ID
    echo "<input type='hidden' name='oldAppID' value='{$oldApptID}'>";
}
$currentAdvisorID = $_POST["advisor"];
$currentDatephp = strtotime($_POST["appTime"]);
// Get appointment information for current appointment, even if it's taken
$appointments = Appointment::searchAppointments($COMMON, $currentAdvisorID, $student->getMajor(), $_POST["appTime"], null, false, 1, '');
$currentAppt = $appointments[0];
$currentApptID = $currentAppt->getID();
if ($currentAdvisorID != 0) {
    // Individual advisor, so get info from database
    $currentAdvisor = new Advisor($COMMON, $currentAdvisorID);
    $currentAdvisorName = $currentAdvisor->convertFullName();
    $currentAdvisorOffice = $currentAdvisor->getOffice();
} else {
    // Group advising appointment
    $currentAdvisorName = "Group";
}
echo "<h2>Current Appointment</h2>";
echo "<label for='newinfo'>";
echo "Advisor: ", $currentAdvisorName, "<br>";
// Display office for individual advisor
if (isset($currentAdvisorOffice)) {
    echo "Office: ", $currentAdvisorOffice, "<br>";
}
echo "Appointment: ", date('l, F d, Y g:i A', $currentDatephp), "<br>";
echo "Meeting Location: ", $currentAppt->getMeeting(), "</label>";
Example #7
0
if (isset($_POST["advisor"])) {
    // Came from selecting individual advisor
    $localAdvisor = $_POST["advisor"];
} else {
    // Selected group advisor
    $localAdvisor = 0;
}
include '../CommonMethods.php';
include '../Student.php';
include '../Advisor.php';
include '../Appointment.php';
$COMMON = new Common($debug);
$student = new Student($COMMON, $_SESSION['studID']);
if ($localAdvisor != 0) {
    // Get information for individual advisor
    $advisor = new Advisor($COMMON, $localAdvisor);
}
?>

<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Select Appointment</title>
	<link rel='stylesheet' type='text/css' href='../css/standard.css'/>

  </head>
  <body>
    <div id="login">
      <div id="form">
        <div class="top">
		<h1>Select Appointment Time</h1>
Example #8
0
 public function justTheFirstServiceBecauseMyCodeSucks($advisor_id)
 {
     // Get the Advisor, MF
     $advisor = Advisor::find($advisor_id);
     $firstService = $advisor->services->first();
     return $firstService;
 }
Example #9
0
    $i = 0;
    echo "Time: ";
    foreach ($times as $t) {
        echo ++$i, ") ", date('g:i A', strtotime($t)), " ";
    }
}
echo "<br>";
if ($advisor == '') {
    echo "Advisor: All appointments";
} elseif ($advisor == 'I') {
    echo "Advisor: All individual appointments";
} elseif ($advisor == '0') {
    echo "Advisor: All group appointments";
} else {
    // Get advisor info from database
    $advisor = new Advisor($COMMON, $advisor);
    echo "Advisor: ", $advisor->convertFullName();
}
echo "<br>";
if ($studID == '' && $studLN == '') {
    echo "Student: All";
} else {
    $studLN = strtoupper($studLN);
    $studID = strtoupper($studID);
    $sql = "select `LastName`, `StudentID` from Proj2Students where `StudentID` = '{$studID}' or `LastName` = '{$studLN}'";
    $rs = $COMMON->executeQuery($sql, $_SERVER["SCRIPT_NAME"]);
    $row = mysql_fetch_row($rs);
    $studLN = $row[0];
    $studID = $row[1];
    echo "Student: ", $studID, " ", $studLN;
}
Example #10
0
<?php

/* Had to make sure sessions was enabled. Some help here:

https://wiki.umbc.edu/pages/viewpage.action?pageId=46563550

cd /afs/umbc.edu/public/web/sites/coeadvising/prod/php/session/

/usr/bin/fs sa /afs/umbc.edu/public/web/sites/coeadvising/prod/php/session/ web.coeadvising all


then edit .htaccess file here in the same directory

*/
session_start();
include '../CommonMethods.php';
include '../Advisor.php';
$debug = false;
$Common = new Common($debug);
$admin = new Advisor($Common, strtoupper($_POST["UserN"]), md5($_POST["PassW"]));
if ($admin->exists()) {
    // Save away user ID
    $_SESSION["UserID"] = strtoupper($_POST["UserN"]);
    header('Location: AdminUI.php');
} else {
    $_SESSION["UserID"] = -1;
    header('Location: AdminSignIn.php');
}
Example #11
0
      <div id="form">
        <div class="top">
          <h1>Removed Appointment</h1><br>
		  <div class="field">
          <?php 
$debug = false;
include '../CommonMethods.php';
include '../Appointment.php';
include '../Student.php';
include '../Advisor.php';
$COMMON = new Common($debug);
$indID = $_POST["IndApp"];
// Get appointment info from the database
$appt = new Appointment($COMMON, $indID);
$adv = $appt->getAdvisorID();
$advisor = new Advisor($COMMON, $adv);
if ($appt->getEnrolledID()) {
    $student = new Student($COMMON, trim($appt->getEnrolledID()));
    $std = $student->getFirstName() . " " . $student->getLastName();
    $eml = $student->getEmail();
}
$sql = "DELETE FROM `Proj2Appointments` WHERE `id`='{$indID}'";
$rs = $COMMON->executeQuery($sql, "Advising Appointments");
echo "Time: " . date('l, F d, Y g:i A', strtotime($appt->getTime())) . "<br>";
echo "Advisor: " . $advisor->convertFullName() . "<br>";
echo "Majors included: ";
if ($appt->getMajor()) {
    echo $appt->convertMajor() . "<br>";
} else {
    echo "Available to all majors<br>";
}
}
$ServerStatusData = new PMA_ServerStatusData();
$response = PMA_Response::getInstance();
$scripts = $response->getHeader()->getScripts();
$scripts->addFile('server_status_advisor.js');
$output = '<div>';
$output .= $ServerStatusData->getMenuHtml();
$output .= '<a href="#openAdvisorInstructions">';
$output .= PMA_Util::getIcon('b_help.png', __('Instructions'));
$output .= '</a>';
$output .= '<div id="statustabs_advisor"></div>';
$output .= '<div id="advisorInstructionsDialog" style="display:none;">';
$output .= '<p>';
$output .= __('The Advisor system can provide recommendations ' . 'on server variables by analyzing the server status variables.');
$output .= '</p>';
$output .= '<p>';
$output .= __('Do note however that this system provides recommendations ' . 'based on simple calculations and by rule of thumb which may ' . 'not necessarily apply to your system.');
$output .= '</p>';
$output .= '<p>';
$output .= __('Prior to changing any of the configuration, be sure to know ' . 'what you are changing (by reading the documentation) and how ' . 'to undo the change. Wrong tuning can have a very negative ' . 'effect on performance.');
$output .= '</p>';
$output .= '<p>';
$output .= __('The best way to tune your system would be to change only one ' . 'setting at a time, observe or benchmark your database, and undo ' . 'the change if there was no clearly measurable improvement.');
$output .= '</p>';
$output .= '</div>';
$output .= '<div id="advisorData" style="display:none;">';
$advisor = new Advisor();
$output .= htmlspecialchars(json_encode($advisor->run()));
$output .= '</div>';
$output .= '</div>';
$response->addHTML($output);
    }
}
//major stuff
$majorDB = "";
$majorPrint = "All";
if (!empty($majors)) {
    $majorPrint = "";
    foreach ($majors as $m) {
        $majorDB .= $m . " ";
        $majorPrint .= $m . ", ";
    }
    $majorPrint = substr($majorPrint, 0, -2);
}
//get advisor id
$id = $_SESSION['UserID'];
$adv = new Advisor($COMMON, $id);
$advID = $adv->getID();
$location = $adv->getMeeting();
//make sure app doesn't exist
//insert new app to DB
//print app
foreach ($datetimes as $dt) {
    // Attempt to create appointment
    $created = Appointment::createAppointment($COMMON, $dt, $advID, $majorDB, 1, $location);
    echo date('l, F d, Y g:i A', strtotime($dt)), "<br>Advisor: ", $adv->getFirstName(), " ", $adv->getLastName(), "<br>Location: ", $location, " <br> Majors: ", $majorPrint;
    if (!$created) {
        // Appointment already exists
        echo "<br><span style='color:red'>!!</span>";
    }
    echo "<br><br>";
}
Example #14
0
        <div class="top">
		<h1>View Appointment</h1>
	    <div class="field">
	    <?php 
// Search for appointment with this student
$appointments = Appointment::searchAppointments($COMMON, null, null, null, null, null, null, '', $studID);
// if for some reason there really isn't a match, (something got messed up, tell them there really isn't one there)
$num_rows = count($appointments);
if ($num_rows > 0) {
    $appt = $appointments[0];
    // get legit data
    $advisorID = $appt->getAdvisorID();
    $datephp = strtotime($appt->getTime());
    if ($advisorID != 0) {
        // Individual advisor - Get advisor info from database
        $advisor = new Advisor($COMMON, $advisorID);
        $advisorOffice = $advisor->getOffice();
        $advisorName = $advisor->convertFullName();
    } else {
        // Group advisor
        $advisorName = "Group";
    }
    echo "<label for='info'>";
    echo "Advisor: ", $advisorName, "<br>";
    // If individual advisor, display office location
    if (isset($advisorOffice)) {
        echo "Office: ", $advisorOffice, "<br>";
    }
    echo "Appointment: ", date('l, F d, Y g:i A', $datephp), "<br>";
    // Display appointment location
    echo "Meeting Location: ", $appt->getMeeting(), "</label>";
Example #15
0
 /**
  * Adds a rule to the result list
  *
  * @param string $type type of rule
  * @param array  $rule rule itslef
  *
  * @return void
  */
 function addRule($type, $rule)
 {
     switch ($type) {
         case 'notfired':
         case 'fired':
             $jst = Advisor::splitJustification($rule);
             if (count($jst) > 1) {
                 try {
                     /* Translate */
                     $str = $this->translate($jst[0], $jst[1]);
                 } catch (Exception $e) {
                     $this->storeError(sprintf(__('Failed formatting string for rule \'%s\'.'), $rule['name']), $e);
                     return;
                 }
                 $rule['justification'] = $str;
             } else {
                 $rule['justification'] = $this->translate($rule['justification']);
             }
             $rule['id'] = $rule['name'];
             $rule['name'] = $this->translate($rule['name']);
             $rule['issue'] = $this->translate($rule['issue']);
             // Replaces {server_variable} with 'server_variable'
             // linking to server_variables.php
             $rule['recommendation'] = preg_replace('/\\{([a-z_0-9]+)\\}/Ui', '<a href="server_variables.php?' . PMA_URL_getCommon() . '&filter=\\1">\\1</a>', $this->translate($rule['recommendation']));
             // Replaces external Links with PMA_linkURL() generated links
             $rule['recommendation'] = preg_replace_callback('#href=("|\')(https?://[^\\1]+)\\1#i', array($this, '_replaceLinkURL'), $rule['recommendation']);
             break;
     }
     $this->runResult[$type][] = $rule;
 }
Example #16
0
 public function expertiseContainedByAdvisor($advisor_id, $just_id = null)
 {
     $advisor = Advisor::find($advisor_id);
     if ($just_id == '1') {
         return $expertiseContainedByAdvisor = $advisor->expertise()->lists('expertise_id');
     }
     $expertiseContainedByAdvisor = $advisor->expertise()->lists('title', 'expertise_id');
     return $expertiseContainedByAdvisor;
 }
Example #17
0
 function addRule($type, $rule)
 {
     switch ($type) {
         case 'notfired':
         case 'fired':
             $jst = Advisor::splitJustification($rule);
             if (count($jst) > 1) {
                 try {
                     /* Translate */
                     $str = $this->translate($jst[0], $jst[1]);
                 } catch (Exception $e) {
                     $this->runResult['errors'][] = sprintf(__('Failed formatting string for rule \'%s\'. PHP threw following error: %s'), $rule['name'], $e->getMessage());
                     return;
                 }
                 $rule['justification'] = $str;
             } else {
                 $rule['justification'] = $this->translate($rule['justification']);
             }
             $rule['name'] = $this->translate($rule['name']);
             $rule['issue'] = $this->translate($rule['issue']);
             // Replaces {server_variable} with 'server_variable'
             // linking to server_variables.php
             $rule['recommendation'] = preg_replace('/\\{([a-z_0-9]+)\\}/Ui', '<a href="server_variables.php?' . PMA_generate_common_url() . '#filter=\\1">\\1</a>', $this->translate($rule['recommendation']));
             // Replaces external Links with PMA_linkURL() generated links
             $rule['recommendation'] = preg_replace('#href=("|\')(https?://[^\\1]+)\\1#ie', '\'href="\' . PMA_linkURL("\\2") . \'"\'', $rule['recommendation']);
             break;
     }
     $this->runResult[$type][] = $rule;
 }
Example #18
0
	<link rel='stylesheet' type='text/css' href='../css/standard.css'/>
  </head>
  <body>
    <div id="login">
      <div id="form">
        <div class="top">

<?php 
$date = $_POST["date"];
$type = $_POST["type"];
include '../CommonMethods.php';
include '../Advisor.php';
include '../Student.php';
$COMMON = new Common($debug);
$User = $_SESSION["UserID"];
$adv = new Advisor($COMMON, $User);
$id = $adv->getID();
$FirstName = $adv->getFirstName();
$LastName = $adv->getLastName();
echo "<h2>Schedule for {$FirstName} {$LastName}<br>{$date}</h2>";
$date = date('Y-m-d', strtotime($date));
if ($_POST["type"] == 'Both') {
    displayGroup($id, $date);
    displayIndividual($id, $date);
} elseif ($_POST["type"] == 'Individual') {
    displayIndividual($id, $date);
} elseif ($_POST["type"] == 'Group') {
    displayGroup($id, $date);
} else {
    echo "Selection invalid";
}
Example #19
0
    <meta charset="UTF-8" />
    <title>Admin Home</title>
	<link rel='stylesheet' type='text/css' href='../css/standard.css'/>
  </head>
  <body>
    <div id="login">
      <div id="form">
        <div class="top">
	<h2> Hello 
	<?php 
if (!isset($_SESSION["UserID"])) {
    return;
}
$UserID = $_SESSION["UserID"];
// Get advisor info from database
$advisor = new Advisor($COMMON, $UserID);
echo $advisor->getFirstName();
?>
	</h2>
	
	<form action="AdminProcessUI.php" method="post" name="UI">
  
		<input type="submit" name="next" class="button large selection" value="Schedule appointments"><br>
		<input type="submit" name="next" class="button large selection" value="Print schedule for a day"><br>
		<input type="submit" name="next" class="button large selection" value="Edit appointments"><br>
		<input type="submit" name="next" class="button large selection" value="Search for an appointment"><br>
		<input type="submit" name="next" class="button large selection" value="Create new Admin Account"><br>
	
	</form>
	<br>
        
Example #20
0
      <div id="form">
        <div class="top">
		<h1>Cancel Appointment</h1>
	    <div class="field">
	    <?php 
// Get student info from database
$studid = $_SESSION["studID"];
$student = new Student($COMMON, $studid);
// Get student's appointment from database
$appointments = Appointment::searchAppointments($COMMON, null, null, null, null, null, null, '', $studid);
$appt = $appointments[0];
$oldAdvisorID = $appt->getAdvisorID();
$oldDatephp = strtotime($appt->getTime());
if ($oldAdvisorID != 0) {
    // Individual advisor, so get advisor info
    $advisor = new Advisor($COMMON, $oldAdvisorID);
    $oldAdvisorName = $advisor->convertFullName();
    $oldAdvisoOffice = $advisor->getOffice();
} else {
    // Group advisor
    $oldAdvisorName = "Group";
}
// Display current appointment info
echo "<h2>Current Appointment</h2>";
echo "<label for='info'>";
echo "Advisor: ", $oldAdvisorName, "<br>";
// Display office for individual advisor
if (isset($oldAdvisorOffice)) {
    echo "Office: ", $oldAdvisorOffice, "<br>";
}
echo "Appointment: ", date('l, F d, Y g:i A', $oldDatephp), "<br>";