Example #1
0
function list_prof_past_courses_form()
{
    $courses = all_course_data();
    $instructors = all_teachers_data();
    $since_year = array();
    for ($i = 1; $i < 30; $i++) {
        $since_year[$i] = $i;
    }
    /*
     * currently selected values
     */
    $current_instructor = get($_SESSION, 'instructor');
    $current_n = get($_SESSION, 'n');
    dom::h3('section-title', 'View Instructor\'s Teaching History');
    dom::push_div('section');
    dom::push_form();
    dom::label('Instructor:');
    dom::dropdown('instructor', $instructors, $current_instructor, true);
    dom::label('Past Year:');
    dom::dropdown('n', $since_year, $current_n, true);
    dom::hidden('action', 'instructor_history');
    dom::pop();
    if (isset($_SESSION['instructor'])) {
        $teaching_history = list_teaching_history($_SESSION['instructor'], CURRENT_YEAR - $_SESSION['n']);
        while ($row = mysql_fetch_assoc($teaching_history)) {
            dom::label($row['year']);
        }
    }
    dom::pop();
}
Example #2
0
File: dom.php Project: amekusa/plz
 /**
  * Returns DOM attribute(s) expression
  * @example Multiple attributes
  * ```php >> html
  * $var = array (
  *   'name' => 'eula',
  *   'type' => 'checkbox',
  *   'value' => 'agreed'
  * );
  * echo '<input' . dom::attrs($var) . '/>';
  * ```
  * @param array|object $Attrs Associative array the structure of which is `[Name => Value]`
  * @return string DOM attribute(s) expression
  */
 static function attrs($Attrs)
 {
     $r = '';
     foreach ($Attrs as $i => $iValue) {
         $r .= dom::attr($i, $iValue);
     }
     return $r;
 }
Example #3
0
<?php

require_once dirname(__FILE__) . '/_app/module.user.php';
echo dom::render(module('user:join')->run());
Example #4
0
function dom()
{
    $args = func_get_args();
    $dom = new dom(array_shift($args));
    if (in_array($dom->tag, dom::$singulars)) {
        $dom->singular = true;
        return $dom;
    }
    return $dom->append($args);
}
Example #5
0
 function render_body()
 {
     dom::h3('', 'Raw SQL');
     dom::push_form('lists.php');
     dom::textarea("sql");
     dom::br();
     dom::hidden('action', 'sql');
     dom::submit();
     dom::pop();
     list_instructors();
     list_sections();
     list_books();
     list_courses();
 }
Example #6
0
 function render_body()
 {
     dom::h3("center", "logout successful.");
 }
Example #7
0
function prof_special_request_form($username)
{
    $courses = all_course_data();
    dom::h3('section-title', 'Special Reqeusts');
    dom::push_div('section');
    dom::push_form();
    dom::label('Course:');
    dom::dropdown('course_id', $courses);
    dom::textinput('title', 'Title');
    dom::label('Justification');
    dom::textarea('justification');
    dom::hidden('username', $username);
    dom::hidden('action', 'special_request');
    dom::br();
    dom::submit();
    dom::pop();
    dom::pop();
}
Example #8
0
 function render_body()
 {
     $username = $this->get_username();
     prof_course_pref_form($username);
     prof_load_pref_form($username);
     prof_special_request_form($username);
     $semester = CURRENT_SEMESTER;
     if (isset($_SESSION['semester'])) {
         $semester = $_SESSION['semester'];
     }
     $year = CURRENT_YEAR;
     if (isset($_SESSION['year'])) {
         $year = $_SESSION['year'];
     }
     $sections = get_sections_assigned_to($this->get_username(), $semester, $year);
     dom::h3('section-title', 'Assigned to me');
     dom::push_div('section');
     dom::push_form('prefs.php');
     dom::label('semester:');
     dom::dropdown('semester', list_semesters(), $semester, true);
     dom::label('year:');
     dom::dropdown('year', list_years(), $year, true);
     dom::hidden('action', 'set_semester');
     dom::br();
     dom::pop();
     dom::push_table();
     dom::push_tr();
     dom::th('Course Code');
     dom::th('Title');
     dom::th('Time');
     dom::th('Days');
     dom::th('Room');
     dom::th('Building');
     dom::th('Semester');
     dom::th('Year');
     dom::pop();
     while ($r = mysql_fetch_assoc($sections)) {
         dom::push_tr();
         dom::td($r['code']);
         dom::td($r['title']);
         dom::td($r['time']);
         dom::td($r['days']);
         dom::td($r['room']);
         dom::td($r['building']);
         dom::td($r['semester']);
         dom::td($r['year']);
         dom::pop();
     }
     dom::pop();
     dom::pop();
 }
Example #9
0
 private function render_head()
 {
     /* 
      * begin HTML rendering... 
      */
     dom::init($this);
     dom::push_body();
     /*
      * this displays the last error that mySQL encountered, if any,
      * and displays it. else it displays the user message if any.
      *
      * This works pretty well assuming that a single query/operation is
      * mode per POST.
      */
     $mysql_error = $this->get_error();
     $message = $this->get_message();
     if ($mysql_error) {
         dom::push_div('error');
         dom::h3('', $mysql_error);
         dom::pop();
     } else {
         if ($message) {
             dom::push_div('message');
             dom::h3('', $message);
             dom::pop();
         }
     }
     /*
      * clear message and error
      */
     $this->set_error(null);
     $this->set_message(null);
 }
Example #10
0
        unset($bind_tree[$name]);
    }
}
showDebug(2);
// add new names
$nb_new_names = 0;
foreach ($new_names as $name) {
    // domain has a non ascii name
    if (!dom::isNameValid($name['name'])) {
        if (isset($showErrors) && $showErrors) {
            echo 'Not a valid name : ' . $name['name'] . "\n";
        }
        continue;
    }
    // domain has an invalid json value
    $dom = new dom($name['name'], $name);
    if (isset($name['value']) && !$dom->isValueJson($name['value'])) {
        continue;
    }
    // convert data to bind
    $dom->getBindZones();
    if (isset($dom->bindForwards) && count($dom->bindForwards)) {
        $names_block[$name['name']] = $name['expire'];
        $bind_tree[$name['name']] = (array) $dom->bindForwards;
        $nb_new_names++;
    }
}
if (!$nb_new_names) {
    echo 'No new bind domain';
    exit;
}
        return str::equals('close', $self->get('type'));
    });
    $template->let('normalBg', function ($self) {
        return $self->get('type:CLOSE') ? 'hsl(0,30%,40%)' : 'hsl(200,30%,35%)';
    });
    $template->let('normalBorder', function ($self) {
        $normalBorder = $self->get('type:CLOSE') ? 'solid 2px hsl(200,40%,80%)' : 'solid 2px hsl(200,40%,35%)';
    });
    $template->let('hoverBorder', 'solid 2px hsl(50,80%,80%)');
    $template->let('dom', function ($self) {
        $dom = new dom('a');
        $dom->jsCall('toggler', array('states' => $self->get('states'), 'currentIndex' => 0));
        $dom->attr('data-widget', 'toggleButton');
        $dom->attr('onmouseover', "this.style.border = '{$hoverBorder}'; this.style.letterSpacing = '1px';");
        $dom->attr('onmouseout', "this.style.border = '{$normalBorder}'; this.style.letterSpacing = '2px';");
        $dom->css(array('width' => $self->get('width') . 'em', 'cursor' => "default", '-webkit-border-radius' => $self->get('type:CLOSE') ? '0 8px 0 20px' : '4px 4px 0 0', 'display' => 'inline-block', 'vertical-align' => 'text-top', 'letter-spacing' => '2px', 'text-align' => 'center', 'font-size' => $self->get('fontSize') . 'px', 'padding' => $self->get('type:CLOSE') ? '2px 0px 4px 4px' : '2px 0', 'border' => $self->get('normalBorder'), 'color' => $self->get('type:CLOSE') ? 'hsl(200,40%,85%)' : 'hsl(200,40%,80%)', 'margin' => $self->get('type:CLOSE') ? '1px' : '0 8px', 'background' => $self->get('normalBg')));
        return $dom;
    });
    return $template;
});
$widgets->let('window', function () {
    $template = new widget();
    $template->expect('content');
    $template->let('dom', function ($self) {
        $dom = new dom('div');
        $dom->css(array('position' => 'relative', '-webkit-border-radius' => '8px', 'border-bottom' => 'solid 2px hsl(200,35%,55%)', 'background' => 'hsl(200,35%,75%)', 'padding' => '0', 'overflow' => 'hidden'));
        $dom->append(dom('div')->css(array('float' => 'right', 'margin' => '0', 'padding' => '0'))->append(widget('toggleButton')->let('states', array('Close'))->let('type', 'close')), dom('div')->css(array('position' => 'absolute', 'right' => '0', 'bottom' => '0', 'margin' => '0', 'padding' => '0'))->append(widget('toggleButton')->let('states', array('Fullscreen', 'Inline'))), dom('div')->css(array('padding' => '1em', 'padding-bottom' => '10em'))->append($self->get('content')));
        return $dom;
    });
    return $template;
});