コード例 #1
0
 public static function create(array $attributes)
 {
     $model = new Hierarchy();
     $model->fill($attributes);
     $model->save();
     return $model;
 }
コード例 #2
0
 public function testNestedReference()
 {
     $test = new Hierarchy('Root');
     $child1 = $test->addChild('Child 1');
     $child2 = $test->addChild('Child 2');
     $this->dm->persist($child1);
     $this->dm->persist($child2);
     $this->dm->persist($test);
     $this->dm->flush();
     $this->dm->clear();
     $test = $this->dm->getRepository(__NAMESPACE__ . '\\Hierarchy')->findOneBy(array('name' => 'Root'));
     $this->assertNotNull($test);
     $child1 = $test->getChild('Child 1')->setName('Child 1 Changed');
     $child2 = $test->getChild('Child 2')->setName('Child 2 Changed');
     $test->setName('Root Changed');
     $child3 = $test->addChild('Child 3');
     $this->dm->persist($child3);
     $this->dm->flush();
     $this->dm->clear();
     $test = $this->dm->find(__NAMESPACE__ . '\\Hierarchy', $test->getId());
     $this->assertNotNull($test);
     $this->assertEquals('Root Changed', $test->getName());
     $this->assertEquals('Child 1 Changed', $test->getChild(0)->getName());
     $this->assertEquals('Child 2 Changed', $test->getChild(1)->getName());
     $child3 = $this->dm->getRepository(__NAMESPACE__ . '\\Hierarchy')->findOneBy(array('name' => 'Child 3'));
     $this->assertNotNull($child3);
     $child3->setName('Child 3 Changed');
     $this->dm->flush();
     $child3 = $this->dm->getRepository(__NAMESPACE__ . '\\Hierarchy')->findOneBy(array('name' => 'Child 3 Changed'));
     $this->assertNotNull($child3);
     $this->assertEquals('Child 3 Changed', $child3->getName());
     $test = $this->dm->getDocumentCollection(__NAMESPACE__ . '\\Hierarchy')->findOne(array('name' => 'Child 1 Changed'));
     $this->assertFalse(isset($test['children']), 'Test empty array is not stored');
 }
コード例 #3
0
ファイル: EOLStats.php プロジェクト: eliagbayani/maps_test
 public function __construct()
 {
     $this->mysqli =& $GLOBALS['mysqli_connection'];
     if ($GLOBALS['ENV_NAME'] == 'production' && environment_defined('slave')) {
         $this->mysqli_slave = load_mysql_environment('slave');
     } else {
         $this->mysqli_slave =& $this->mysqli;
     }
     $this->sparql_client = SparqlClient::connection();
     $this->published_id = TranslatedResourceStatus::find_or_create_by_label('Published')->id;
     $this->trusted_id = Vetted::trusted()->id;
     $this->unknown_id = Vetted::unknown()->id;
     $this->untrusted_id = Vetted::untrusted()->id;
     $this->visible_id = Visibility::visible()->id;
     $this->invisible_id = Visibility::invisible()->id;
     $this->master_curator_id = CuratorLevel::master_curator()->id;
     $this->full_curator_id = CuratorLevel::full_curator()->id;
     $this->assistant_curator_id = CuratorLevel::assistant_curator()->id;
     $this->curator_ids = CuratorLevel::curator_ids();
     $this->data_object_scope = ChangeableObjectType::data_object_scope();
     $this->worms_content_partner_id = ContentPartner::find_or_create_by_full_name('World Register of Marine Species')->id;
     $this->col_hierarchy_id = Hierarchy::find_or_create_by_label('Species 2000 & ITIS Catalogue of Life: Annual Checklist 2011')->id;
     $this->latest_harvest_event_ids();
     $this->worms_latest_harvest_event_id();
 }
コード例 #4
0
 /**
  * Augments (@link Hierarchy::liveChildren()}
  *
  * @param $staged DataList
  * @param $showAll boolean
  **/
 public function liveChildren($showAll = false, $onlyDeletedFromStage = false)
 {
     $staged = parent::liveChildren($showAll, $onlyDeletedFromStage);
     if ($this->shouldFilter()) {
         // Filter the SiteTree
         return $staged->exclude("ClassName", $this->owner->getExcludedSiteTreeClassNames());
     }
 }
コード例 #5
0
    public function getChildrenAsUL($attributes = "", $titleEval = '"<li>" . $child->Title', $extraArg = null, $limitToMarked = false, $childrenMethod = "AllChildrenIncludingDeleted", $numChildrenMethod = "numChildren", $rootCall = true, $nodeCountThreshold = null, $nodeCountCallback = null)
    {
        if (get_class($this->owner) == 'NewsIndex') {
            $strURL = $this->owner->getNewsItemsEditLink();
            $original = parent::getChildrenAsUL($attributes, $titleEval, $extraArg, $limitToMarked, $childrenMethod, $numChildrenMethod, $rootCall, $nodeCountThreshold, $nodeCountCallback);
            $output = $original ? $original : "";
            $output .= "<ul{$attributes}>\n";
            $output .= '<li class="readonly">
				<a class="cms-panel-link" data-pjax-target="Content" href="' . $strURL . '">' . $this->owner->getTreeEditLinkText() . '</a>
			</li>';
            $output .= "</ul>";
            return $output;
        } else {
            return parent::getChildrenAsUL($attributes, $titleEval, $extraArg, $limitToMarked, $childrenMethod, $numChildrenMethod, $rootCall, $nodeCountThreshold, $nodeCountCallback);
        }
    }
コード例 #6
0
 public function setUp()
 {
     // We cannot run the tests on this abstract class.
     if (get_class($this) == "SapphireTest") {
         $this->skipTest = true;
     }
     if ($this->skipTest) {
         $this->markTestSkipped(sprintf('Skipping %s ', get_class($this)));
         return;
     }
     // Mark test as being run
     $this->originalIsRunningTest = self::$is_running_test;
     self::$is_running_test = true;
     // i18n needs to be set to the defaults or tests fail
     i18n::set_locale(i18n::default_locale());
     i18n::config()->date_format = null;
     i18n::config()->time_format = null;
     // Set default timezone consistently to avoid NZ-specific dependencies
     date_default_timezone_set('UTC');
     // Remove password validation
     $this->originalMemberPasswordValidator = Member::password_validator();
     $this->originalRequirements = Requirements::backend();
     Member::set_password_validator(null);
     Config::inst()->update('Cookie', 'report_errors', false);
     if (class_exists('RootURLController')) {
         RootURLController::reset();
     }
     if (class_exists('Translatable')) {
         Translatable::reset();
     }
     Versioned::reset();
     DataObject::reset();
     if (class_exists('SiteTree')) {
         SiteTree::reset();
     }
     Hierarchy::reset();
     if (Controller::has_curr()) {
         Controller::curr()->setSession(Injector::inst()->create('Session', array()));
     }
     Security::$database_is_ready = null;
     // Add controller-name auto-routing
     Config::inst()->update('Director', 'rules', array('$Controller//$Action/$ID/$OtherID' => '*'));
     $fixtureFile = static::get_fixture_file();
     $prefix = defined('SS_DATABASE_PREFIX') ? SS_DATABASE_PREFIX : 'ss_';
     // Set up email
     $this->originalMailer = Email::mailer();
     $this->mailer = new TestMailer();
     Email::set_mailer($this->mailer);
     Config::inst()->remove('Email', 'send_all_emails_to');
     // Todo: this could be a special test model
     $this->model = DataModel::inst();
     // Set up fixture
     if ($fixtureFile || $this->usesDatabase || !self::using_temp_db()) {
         if (substr(DB::get_conn()->getSelectedDatabase(), 0, strlen($prefix) + 5) != strtolower(sprintf('%stmpdb', $prefix))) {
             //echo "Re-creating temp database... ";
             self::create_temp_db();
             //echo "done.\n";
         }
         singleton('DataObject')->flushCache();
         self::empty_temp_db();
         foreach ($this->requireDefaultRecordsFrom as $className) {
             $instance = singleton($className);
             if (method_exists($instance, 'requireDefaultRecords')) {
                 $instance->requireDefaultRecords();
             }
             if (method_exists($instance, 'augmentDefaultRecords')) {
                 $instance->augmentDefaultRecords();
             }
         }
         if ($fixtureFile) {
             $pathForClass = $this->getCurrentAbsolutePath();
             $fixtureFiles = is_array($fixtureFile) ? $fixtureFile : array($fixtureFile);
             $i = 0;
             foreach ($fixtureFiles as $fixtureFilePath) {
                 // Support fixture paths relative to the test class, rather than relative to webroot
                 // String checking is faster than file_exists() calls.
                 $isRelativeToFile = strpos('/', $fixtureFilePath) === false || preg_match('/^\\.\\./', $fixtureFilePath);
                 if ($isRelativeToFile) {
                     $resolvedPath = realpath($pathForClass . '/' . $fixtureFilePath);
                     if ($resolvedPath) {
                         $fixtureFilePath = $resolvedPath;
                     }
                 }
                 $fixture = Injector::inst()->create('YamlFixture', $fixtureFilePath);
                 $fixture->writeInto($this->getFixtureFactory());
                 $this->fixtures[] = $fixture;
                 // backwards compatibility: Load first fixture into $this->fixture
                 if ($i == 0) {
                     $this->fixture = $fixture;
                 }
                 $i++;
             }
         }
         $this->logInWithPermission("ADMIN");
     }
     // Preserve memory settings
     $this->originalMemoryLimit = ini_get('memory_limit');
     // turn off template debugging
     Config::inst()->update('SSViewer', 'source_file_comments', false);
     // Clear requirements
     Requirements::clear();
 }
コード例 #7
0
 public static function begin_concept_assignment($hierarchy_id = null, $use_synonyms_for_merging = false)
 {
     $mysqli =& $GLOBALS['mysqli_connection'];
     if (!defined('SOLR_SERVER') || !SolrAPI::ping(SOLR_SERVER, 'hierarchy_entries')) {
         debug("ERROR: No Solr server; cannot begin_concept_assignment");
         return false;
     }
     // looking up which hierarchies might have nodes in preview mode
     // this will save time later on when we need to check published vs preview taxa
     self::lookup_preview_harvests();
     $confirmed_exclusions = self::check_curator_assertions();
     $hierarchies_compared = array();
     if ($default_id = Hierarchy::default_id()) {
         $default_hierarchy = Hierarchy::find($default_id);
         // TODO: This should NOT be hard-coded. ...particularly without an
         // explanation. :| ...And isn't this just ... undone as soon as we
         // leave this block by "$hierarchy_lookup_ids2 = array();"? ...This
         // seems stupid.
         if (@$default_hierarchy->id) {
             $hierarchy_lookup_ids2 = array($default_id => 1475377);
         }
     }
     $hierarchy_lookup_ids2 = array();
     // TODO: This is a SLOW, huge query. If we had a denormalized HE count
     // on each hierarchy (and, truly, we should), it would be super-fast. Do
     // this.
     $result = $mysqli->query("SELECT id ,hierarchy_entries_count as count FROM hierarchies ");
     while ($result && ($row = $result->fetch_assoc())) {
         // TODO: DON'T hard-code this (this is GBIF Nub Taxonomy).
         // Instead, add an attribute to hierarchies called "no_comparisons"
         // and check that, and make sure the migration for that sets the
         // value of that field to true for all hierarchies with a ).
         // Also make sure curators can set that value from the resource
         // page.
         if ($row['id'] == 129) {
             continue;
         }
         $hierarchy_lookup_ids2[$row['id']] = $row['count'];
     }
     // TODO: This is, again, a GBIF Nub taxonomy:
     $hierarchy_lookup_ids2[800] = 1;
     arsort($hierarchy_lookup_ids2);
     // if the function is passed a hierarchy_id then make the first loop
     // just that hierarchy otherwise make the first loop the same as the
     // inner loop - compare everything with everything else
     if ($hierarchy_id) {
         $hierarchy1 = Hierarchy::find($hierarchy_id);
         // TODO: Don't we have this in $hierarchy_lookup_ids2 ?
         $count1 = $hierarchy1->count_entries();
         $hierarchy_lookup_ids1[$hierarchy_id] = $count1;
     } else {
         $hierarchy_lookup_ids1 = $hierarchy_lookup_ids2;
     }
     foreach ($hierarchy_lookup_ids1 as $id1 => $count1) {
         $hierarchy1 = Hierarchy::find($id1);
         if (@(!$hierarchy1->id)) {
             debug("ERROR: Attempt to compare hierarchy {$id1}, but it was missing");
             continue;
         }
         foreach ($hierarchy_lookup_ids2 as $id2 => $count2) {
             $hierarchy2 = Hierarchy::find($id2);
             if (@(!$hierarchy2->id)) {
                 debug("WARNING: Skipping compare of missing hierarchy {$id2}");
                 continue;
             }
             // already compared - skip
             if (isset($hierarchies_compared[$hierarchy1->id][$hierarchy2->id])) {
                 continue;
             }
             debug("Comparing hierarchy {$id1} ({$hierarchy1->label}; {$count1} entries) to {$id2} ({$hierarchy2->label}; {$count2} entries)");
             // have the smaller hierarchy as the first parameter so the
             // comparison will be quicker
             if ($count1 < $count2) {
                 self::assign_concepts_across_hierarchies($hierarchy1, $hierarchy2, $confirmed_exclusions, $use_synonyms_for_merging);
             } else {
                 self::assign_concepts_across_hierarchies($hierarchy2, $hierarchy1, $confirmed_exclusions, $use_synonyms_for_merging);
             }
             $hierarchies_compared[$hierarchy1->id][$hierarchy2->id] = 1;
             $hierarchies_compared[$hierarchy2->id][$hierarchy1->id] = 1;
         }
     }
 }
コード例 #8
0
ファイル: hierarchy.class.php プロジェクト: nikosv/openeclass
 /**
  * Build an HTML table containing navigation code for the given nodes
  *
  * @param  array    $nodes         - The nodes (full sql row) whose children we want to navigate to
  * @param  string   $url           - The php script to call in the navigational URLs
  * @param  function $countCallback - An optional closure that will be used for the counting
  * @param  bool     $showEmpty     - Whether to display nodes with count == 0
  * @return string   $ret           - The returned HTML output
  */
 public function buildNodesNavigationHtml($nodes, $url, $countCallback = null, $showEmpty = true, $subtrees = array())
 {
     global $langAvCours, $langAvCourses;
     $ret = '';
     if (count($nodes) > 0) {
         $nodesWK = array();
         $coursedeps = array();
         foreach ($nodes as $node) {
             $nodesWK[$node->id] = $node;
         }
         uasort($nodesWK, function ($a, $b) {
             $priorityA = intval($a->order_priority);
             $priorityB = intval($b->order_priority);
             $nameA = Hierarchy::unserializeLangField($a->name);
             $nameB = Hierarchy::unserializeLangField($b->name);
             if ($priorityA == $priorityB) {
                 if ($nameA == $nameB) {
                     return 0;
                 } else {
                     return $nameA > $nameB ? 1 : -1;
                 }
             } else {
                 return $priorityA < $priorityB ? 1 : -1;
             }
         });
         // course department counting
         //SELECT COUNT(course_department.id) AS count,department FROM course_department
         //              JOIN course ON course_department.course=course.id
         //              WHERE course.visible != 3 GROUP BY department;
         /*Database::get()->queryFunc("select department, count(id) as count from course_department group by department", function($row) use (&$coursedeps) {
               $coursedeps[intval($row->department)] = $row->count;
           });*/
         Database::get()->queryFunc("SELECT COUNT(course_department.id) AS count,department FROM course_department \n                                            JOIN course ON course_department.course = course.id \n                                        WHERE course.visible != " . COURSE_INACTIVE . " GROUP BY department", function ($row) use(&$coursedeps) {
             $coursedeps[intval($row->department)] = $row->count;
         });
         foreach ($nodesWK as $key => $node) {
             $id = intval($key);
             $code = $node->code;
             $name = self::unserializeLangField($node->name);
             $count = 0;
             if (isset($subtrees[$id])) {
                 foreach ($subtrees[$id] as $subkey => $subnode) {
                     // TODO: callback mechanism might need further optimization to avoid repeating extra sql query foreach subnode
                     if ($countCallback !== null && is_callable($countCallback)) {
                         $count += $countCallback($subnode);
                     } else {
                         // fast count using pre-loaded array in memory
                         $count += isset($coursedeps[$subnode]) ? $coursedeps[$subnode] : 0;
                     }
                 }
             }
             if ($showEmpty || $count > 0) {
                 $ret .= "<li class='list-group-item' ><a href='{$url}.php?fc=" . $id . "'>" . q($name) . '</a>';
                 $ret .= strlen(q($code)) > 0 ? "&nbsp;(" . q($code) . ")" : '';
                 $ret .= "<small>&nbsp;&nbsp;-&nbsp;&nbsp;" . $count . "&nbsp;" . ($count == 1 ? $langAvCours : $langAvCourses) . "</small></li>";
             }
         }
     }
     return $ret;
 }
コード例 #9
0
ファイル: display_profile.php プロジェクト: nikosv/openeclass
 * Contact address: GUnet Asynchronous eLearning Group,
 *                  Network Operations Center, University of Athens,
 *                  Panepistimiopolis Ilissia, 15784, Athens, Greece
 *                  e-mail: info@openeclass.org
 * ======================================================================== */


$require_login = true;
$require_valid_uid = TRUE;
include '../../include/baseTheme.php';
require_once 'modules/auth/auth.inc.php';
require_once 'include/lib/hierarchy.class.php';
require_once 'include/lib/user.class.php';
require_once 'modules/admin/custom_profile_fields_functions.php';

$tree = new Hierarchy();
$user = new User();

$toolName = $langMyProfile;

$userdata = array();

if (isset($_GET['id']) and isset($_GET['token'])) {
    $id = intval($_GET['id']);
    if (!token_validate($id, $_GET['token'], 3600)) {
        forbidden($_SERVER['REQUEST_URI']);
    }
    $pageName = $langUserProfile;
} else {
    $id = $uid;
}
コード例 #10
0
ファイル: searchcours.php プロジェクト: kostastzo/openeclass
 *
 * Contact address: GUnet Asynchronous eLearning Group,
 *                  Network Operations Center, University of Athens,
 *                  Panepistimiopolis Ilissia, 15784, Athens, Greece
 *                  e-mail: info@openeclass.org
 * ======================================================================== */
/**
 * @file searchcours.php
 * @brief search on courses by title, code, type and faculty
 */
$require_departmentmanage_user = true;
require_once '../../include/baseTheme.php';
require_once 'include/lib/hierarchy.class.php';
require_once 'include/lib/user.class.php';
require_once 'hierarchy_validations.php';
$tree = new Hierarchy();
$user = new User();
load_js('jstree');
load_js('bootstrap-datetimepicker');
$head_content .= "<script type='text/javascript'>\n        \$(function() {\n            \$('#id_date').datetimepicker({\n                format: 'dd-mm-yyyy hh:ii', \n                pickerPosition: 'bottom-left', \n                language: '" . $language . "',\n                autoclose: true    \n            });\n        });\n    </script>";
$toolName = $langSearchCourse;
$navigation[] = array("url" => "index.php", "name" => $langAdmin);
$tool_content .= action_bar(array(array('title' => $langBack, 'url' => "index.php", 'icon' => 'fa-reply', 'level' => 'primary-label')));
$reg_flag = isset($_GET['reg_flag']) ? intval($_GET['reg_flag']) : '';
$date = '';
// search form
$tool_content .= "<div class='form-wrapper'>\n    <form role='form' class='form-horizontal' action='listcours.php?search=yes' method='get'>\n    <fieldset>      \n      <div class='form-group'>\n      <label for='formsearchtitle' class='col-sm-2 control-label'>{$langTitle}:</label>\n        <div class='col-sm-10'><input type='text' class='form-control' id='formsearchtitle' name='formsearchtitle' value='" . @$searchtitle . "'></div>\n      </div>\n      <div class='form-group'>\n        <label for='formsearchcode' class='col-sm-2 control-label'>{$langCourseCode}:</label>\n        <div class='col-sm-10'>\n            <input type='text' class='form-control' name='formsearchcode' value='" . @$searchcode . "'>           \n        </div>\n      </div>";
if (isset($_GET['searchcode'])) {
    switch ($searchcode) {
        case "2":
            $typeSel[2] = "selected";
コード例 #11
0
ファイル: index.php プロジェクト: nikosv/openeclass
$require_current_course = true;
$require_course_admin = true;
$require_help = true;
$helpTopic = 'Infocours';
require_once '../../include/baseTheme.php';
require_once 'include/log.php';
require_once 'include/lib/user.class.php';
require_once 'include/lib/course.class.php';
require_once 'include/lib/hierarchy.class.php';
require_once 'include/course_settings.php';
require_once 'modules/sharing/sharing.php';

$user = new User();
$course = new Course();
$tree = new Hierarchy();

// departments and validation
$depadmin_mode = get_config('restrict_teacher_owndep') && !$is_admin;
$allowables = array();
if ($depadmin_mode) {
    // Method: getDepartmentIdsAllowedForCourseCreation
    // fetches only specific tree nodes, not their sub-children
    //$user->getDepartmentIdsAllowedForCourseCreation($uid);
    // the code below searches for the allow_course flag in the user's department subtrees
    $userdeps = $user->getDepartmentIds($uid);
    $subs = $tree->buildSubtreesFull($userdeps);
    foreach ($subs as $node) {
        if (intval($node->allow_course) === 1) {
            $allowables[] = $node->id;
        }
コード例 #12
0
ファイル: init.php プロジェクト: nikosv/openeclass
 // Check for course visibility by current user
 $status = 0;
 // The admin and power users can see all courses as adminOfCourse
 if ($is_admin or $is_power_user) {
     $status = USER_TEACHER;
 } else {
     $stat = Database::get()->querySingle("SELECT status FROM course_user\n                                                           WHERE user_id = ?d AND\n                                                           course_id = ?d", $uid, $course_id);
     if ($stat) {
         $status = $stat->status;
     } else {
         // the department manager has rights to the courses of his department(s)
         if ($is_departmentmanage_user && $is_usermanage_user && !$is_power_user && !$is_admin && isset($course_code)) {
             require_once 'include/lib/hierarchy.class.php';
             require_once 'include/lib/course.class.php';
             require_once 'include/lib/user.class.php';
             $treeObj = new Hierarchy();
             $courseObj = new Course();
             $userObj = new User();
             $atleastone = false;
             $subtrees = $treeObj->buildSubtrees($userObj->getDepartmentIds($uid));
             $depIds = $courseObj->getDepartmentIds($course_id);
             foreach ($depIds as $depId) {
                 if (in_array($depId, $subtrees)) {
                     $atleastone = true;
                     break;
                 }
             }
             if ($atleastone) {
                 $status = 1;
                 $is_course_admin = true;
                 $_SESSION['courses'][$course_code] = USER_DEPARTMENTMANAGER;
コード例 #13
0
/**
 * @param string $code
 * @param string $title
 * @param string $prof
 * @param string $lang
 * @param string $type - can be null
 * @param int $vis
 * @param string $desc
 * @param mixed $faculty - can be null
 */
function course_details_form($code, $title, $prof, $lang, $type, $vis, $desc, $faculty) {
    global $langInfo1, $langInfo2, $langCourseCode, $langLanguage, $langTitle,
    $langCourseDescription, $langFaculty, $langCourseVis,
    $langTeacher, $langUsersWillAdd,
    $langOk, $langAll, $langsTeachers, $langMultiRegType,
    $langNone, $langOldValue, $treeObj, $langBack, $course_code;

    list($tree_js, $tree_html) = $treeObj->buildCourseNodePicker();
    if ($type) {
        if (isset($GLOBALS['lang' . $type])) {
            $type_label = ' (' . $GLOBALS['lang' . $type] . ')';
        } else {
            $type_label = ' (' . $type . ')';
        }
    } else {
        $type_label = '';
    }
    if (is_array($faculty)) {
        foreach ($faculty as $entry) {
            $old_faculty_names[] = q(Hierarchy::unserializeLangField($entry['name']));
        }
        $old_faculty = implode('<br>', $old_faculty_names);
    } else {
        $old_faculty = q(Hierarchy::unserializeLangField($faculty) . $type_label);
    }
    $formAction = $_SERVER['SCRIPT_NAME'];
    if (isset($GLOBALS['course_code'])) {
        $formAction .= '?course=' . $GLOBALS['course_code'];
    }
    return action_bar(array(
        array('title' => $langBack,
              'url' => "index.php?course=$course_code",
              'icon' => 'fa-reply',
              'level' => 'primary-label'))) . "
        <div class='alert alert-info'>$langInfo1 <br> $langInfo2</div>
                <div class='row'>
                <div class='col-md-12'>
                <div class='form-wrapper' >
                <form class='form-horizontal' role='form' action='$formAction' method='post' onsubmit='return validateNodePickerForm();' >

                    <div class='form-group'>
                        <label for='course_code' class='col-sm-3 control-label'>$langCourseCode:</label>
                        <div class='col-sm-9'>
                            <input type='text' class='form-control' id='course_code' name='course_code' value='" . q($code) . "'>
                        </div>
                    </div>
                    <div class='form-group'>
                        <label for='course_code' class='col-sm-3 control-label'>$langLanguage:</label>
                        <div class='col-sm-9'>
                            " . lang_select_options('course_lang') . "
                        </div>
                    </div>
                    <div class='form-group'>
                        <label for='course_title' class='col-sm-3 control-label'>$langTitle:</label>
                        <div class='col-sm-9'>
                            <input class='form-control' type='text' id='course_title' name='course_title' value='" . q($title) . "' />
                        </div>
                    </div>

                    <div class='form-group'>
                        <label class='col-sm-3 control-label'>$langCourseDescription:</label>
                        <div class='col-sm-9'>
                            " . rich_text_editor('course_desc', 10, 40, purify($desc)) . "
                        </div>
                    </div>
                    <div class='form-group'>
                        <label class='col-sm-3 control-label'>$langFaculty:</label>
                        <div class='col-sm-9'>
                            " . $tree_html . "<br>$langOldValue: <i>$old_faculty</i>
                        </div>
                    </div>
                    <div class='form-group'>
                        <label class='col-sm-3 control-label'>$langCourseVis:</label>
                        <div class='col-sm-9'>
                            " . visibility_select($vis) . "
                        </div>
                    </div>
                    <div class='form-group'>
                        <label for='course_prof' class='col-sm-3 control-label'>$langTeacher:</label>
                        <div class='col-sm-9'>
                            <input class='form-control' type='text' id='course_prof' name='course_prof' value='" . q($prof) . "' size='50' />
                        </div>
                    </div>
                    <div class='form-group'>
                    <label class='col-sm-3 control-label'>$langUsersWillAdd:</label>

                        <div class='col-sm-9'>
                            <input type='radio' name='add_users' value='all' id='add_users_all' checked='checked'>
                           $langAll<br>
                           <input type='radio' name='add_users' value='prof' id='add_users_prof'>
                           $langsTeachers<br>
                           <input type='radio' name='add_users' value='none' id='add_users_none'>
                           $langNone
                        </div>
                    </div>
                    <div class='form-group'>
                        <label class='col-sm-3 control-label'>$langMultiRegType:</label>
                        <div class='col-sm-9'>
                            <input type='checkbox' name='create_users' value='1' id='create_users' checked='checked'>
                        </div>
                    </div>
                    <div class='form-group'>
                        <div class='col-sm-offset-3 col-sm-9'>
                        <input class='btn btn-primary' type='submit' name='create_restored_course' value='$langOk' />
                      <input type='hidden' name='restoreThis' value='" . q($_POST['restoreThis']) . "' />
                          </div>
                    </div>
                " . generate_csrf_token_form_field() . "
                </form>
                </div>
                </div>
                </div>
    ";
}
コード例 #14
0
ファイル: Hierarchy.php プロジェクト: nomidi/sapphire
 public static function reset()
 {
     self::$marked = array();
     self::$expanded = array();
     self::$treeOpened = array();
 }
コード例 #15
0
ファイル: listfaculte.php プロジェクト: kostastzo/openeclass
 *                  Panepistimiopolis Ilissia, 15784, Athens, Greece
 *                  e-mail: info@openeclass.org
 * ======================================================================== */
require_once '../../include/baseTheme.php';
require_once 'include/lib/hierarchy.class.php';
$redirectUrl = "modules/auth/opencourses.php?fc=";
$countCallback = null;
if (defined('LISTING_MODE') && LISTING_MODE === 'COURSE_METADATA') {
    require_once 'modules/course_metadata/CourseXML.php';
    $redirectUrl = "modules/course_metadata/opencourses.php?fc=";
    $countCallback = CourseXMLElement::getCountCallback();
    // exit if feature disabled
    if (!get_config('opencourses_enable')) {
        header("Location: {$urlServer}");
        exit;
    }
}
$tree = new Hierarchy();
$pageName = $langSelectFac;
$roots = $tree->buildRootsArray();
if (count($roots) <= 0) {
    die("ERROR: no root nodes");
} else {
    if (count($roots) == 1) {
        header("Location:" . $urlServer . $redirectUrl . intval($roots[0]));
        exit;
    } else {
        $tool_content = $tree->buildNodesNavigationHtml($roots, 'opencourses', $countCallback);
    }
}
draw($tool_content, (isset($uid) and $uid) ? 1 : 0);
コード例 #16
0
ファイル: migration.php プロジェクト: adamfranco/harmoni
 /**
  * Create a new node and its children
  * 
  * @param object Hierarchy $newHierarchy
  * @param object Node $oldNode
  * @param optional object Id $parentId 
  * @return void
  * @access protected
  * @since 4/17/08
  */
 protected function addNode(Hierarchy $newHierarchy, Node $oldNode, Id $parentId = null)
 {
     // If it has already been created, get it and try to set its parent
     try {
         $newNode = $newHierarchy->getNode($oldNode->getId());
         if (!is_null($parentId)) {
             try {
                 $newNode->addParent($parentId);
             } catch (Exception $e) {
                 // Do nothing if the child already exists
                 if ($e->getMessage() != "A child with the given id already exists!") {
                     throw $e;
                 }
             }
         }
     } catch (UnknownIdException $e) {
         if (is_null($parentId)) {
             $newNode = $newHierarchy->createRootNode($oldNode->getId(), $oldNode->getType(), $oldNode->getDisplayName(), $oldNode->getDescription());
         } else {
             $newNode = $newHierarchy->createNode($oldNode->getId(), $parentId, $oldNode->getType(), $oldNode->getDisplayName(), $oldNode->getDescription());
         }
         $this->nodeStatus->updateStatistics();
     }
     $oldChildren = $oldNode->getChildren();
     while ($oldChildren->hasNext()) {
         $oldChild = $oldChildren->next();
         $this->addNode($newHierarchy, $oldChild, $newNode->getId());
     }
 }
コード例 #17
0
ファイル: Tasks.php プロジェクト: eliagbayani/maps_test
 public static function update_taxon_concept_names($taxon_concept_ids)
 {
     if (!$taxon_concept_ids) {
         return false;
     }
     if (is_numeric($taxon_concept_ids)) {
         $taxon_concept_ids = array($taxon_concept_ids);
     }
     $mysqli =& $GLOBALS['db_connection'];
     $started_new_transaction = false;
     if (!$mysqli->in_transaction()) {
         $mysqli->begin_transaction();
         $started_new_transaction = true;
     }
     $batches = array_chunk($taxon_concept_ids, 500);
     foreach ($batches as $batch_ids) {
         usleep(500000);
         $name_ids = array();
         $matching_ids = array();
         $query = "\n            (SELECT he.taxon_concept_id, he.id, he.name_id, 'preferred' as type FROM hierarchy_entries he WHERE taxon_concept_id IN (" . implode(",", $batch_ids) . ") AND ((he.published=1 AND he.visibility_id=" . Visibility::visible()->id . ") OR (he.published=0 AND he.visibility_id=" . Visibility::preview()->id . ")))\n            UNION\n            (SELECT he.taxon_concept_id, s.hierarchy_entry_id, s.name_id, 'synonym' as type\n            FROM hierarchy_entries he\n            JOIN synonyms s ON (he.id=s.hierarchy_entry_id)\n            WHERE he.taxon_concept_id IN (" . implode(",", $batch_ids) . ")\n            AND s.language_id=0\n            AND s.synonym_relation_id!=" . SynonymRelation::find_or_create_by_translated_label('genbank common name')->id . "\n            AND s.synonym_relation_id!=" . SynonymRelation::find_or_create_by_translated_label('common name')->id . "\n            AND s.synonym_relation_id!=" . SynonymRelation::find_or_create_by_translated_label('blast name')->id . "\n            AND s.synonym_relation_id!=" . SynonymRelation::find_or_create_by_translated_label('genbank acronym')->id . "\n            AND s.synonym_relation_id!=" . SynonymRelation::find_or_create_by_translated_label('acronym')->id . "\n            AND ((he.published=1 AND he.visibility_id=" . Visibility::visible()->id . ") OR (he.published=0 AND he.visibility_id=" . Visibility::preview()->id . ")))";
         foreach ($mysqli->iterate_file($query) as $row_num => $row) {
             $taxon_concept_id = $row[0];
             $hierarchy_entry_id = $row[1];
             $name_id = $row[2];
             $name_type = $row[3];
             $name_ids[$name_id][$taxon_concept_id] = 1;
             $matching_ids[$taxon_concept_id][$name_id][$hierarchy_entry_id] = $name_type;
         }
         if ($name_ids) {
             //This makes sure we have a scientific name, gets the canonicalFormID
             $query = "SELECT n.id, n_match.id FROM names n JOIN canonical_forms cf ON (n.canonical_form_id=cf.id) JOIN names n_match ON (cf.id=n_match.canonical_form_id) WHERE n.id IN (" . implode(",", array_keys($name_ids)) . ") AND n_match.string=cf.string";
             foreach ($mysqli->iterate_file($query) as $row_num => $row) {
                 $original_name_id = $row[0];
                 $canonical_name_id = $row[1];
                 if ($original_name_id != $canonical_name_id) {
                     foreach ($name_ids[$original_name_id] as $taxon_concept_id => $junk) {
                         $matching_ids[$taxon_concept_id][$canonical_name_id][0] = 1;
                     }
                 }
             }
         }
         $common_names = array();
         $preferred_in_language = array();
         $query = "SELECT he.taxon_concept_id, he.published, he.visibility_id, s.id, s.hierarchy_id, s.hierarchy_entry_id, s.name_id, s.language_id, s.preferred, s.vetted_id FROM hierarchy_entries he JOIN synonyms s ON (he.id=s.hierarchy_entry_id) JOIN vetted v ON (s.vetted_id=v.id) WHERE he.taxon_concept_id IN (" . implode(",", $batch_ids) . ") AND s.language_id!=0 AND (s.synonym_relation_id=" . SynonymRelation::genbank_common_name()->id . " OR s.synonym_relation_id=" . SynonymRelation::common_name()->id . ") ORDER BY s.language_id, (s.hierarchy_id=" . Hierarchy::contributors()->id . ") DESC, v.view_order ASC, s.preferred DESC, s.id DESC";
         foreach ($mysqli->iterate_file($query) as $row_num => $row) {
             $taxon_concept_id = $row[0];
             $published = $row[1];
             $visibility_id = $row[2];
             $synonym_id = $row[3];
             $hierarchy_id = $row[4];
             $hierarchy_entry_id = $row[5];
             $name_id = $row[6];
             $language_id = $row[7];
             $preferred = $row[8];
             $vetted_id = $row[9];
             // skipping Wikipedia common names entirely
             if ($hierarchy_id == @Hierarchy::wikipedia()->id) {
                 continue;
             }
             $curator_name = $hierarchy_id == @Hierarchy::contributors()->id;
             $ubio_name = $hierarchy_id == @Hierarchy::ubio()->id;
             if ($curator_name || $ubio_name || $curator_name || $published == 1 && $visibility_id == Visibility::visible()->id) {
                 if (isset($preferred_in_language[$taxon_concept_id][$language_id])) {
                     $preferred = 0;
                 }
                 if ($preferred && $curator_name && ($vetted_id == Vetted::trusted()->id || $vetted_id == Vetted::unknown()->id)) {
                     $preferred_in_language[$taxon_concept_id][$language_id] = 1;
                 } else {
                     $preferred = 0;
                 }
                 if (!isset($common_names[$taxon_concept_id])) {
                     $common_names[$taxon_concept_id] = array();
                 }
                 $common_names[$taxon_concept_id][] = array('synonym_id' => $synonym_id, 'language_id' => $language_id, 'name_id' => $name_id, 'hierarchy_entry_id' => $hierarchy_entry_id, 'preferred' => $preferred, 'vetted_id' => $vetted_id, 'is_curator_name' => $curator_name);
             }
         }
         // if there was no preferred name
         foreach ($common_names as $taxon_concept_id => $arr) {
             foreach ($arr as $key => $arr2) {
                 if (@(!$preferred_in_language[$taxon_concept_id][$arr2['language_id']]) && ($arr2['vetted_id'] == Vetted::trusted()->id || $arr2['vetted_id'] == Vetted::unknown()->id)) {
                     $common_names[$taxon_concept_id][$key]['preferred'] = 1;
                     $preferred_in_language[$taxon_concept_id][$arr2['language_id']] = 1;
                 }
             }
         }
         $mysqli->delete("DELETE FROM taxon_concept_names WHERE taxon_concept_id IN (" . implode(",", $batch_ids) . ")");
         $tmp_file_path = temp_filepath();
         if (!($LOAD_DATA_TEMP = fopen($tmp_file_path, "w+"))) {
             debug(__CLASS__ . ":" . __LINE__ . ": Couldn't open file: " . $tmp_file_path);
             return;
         }
         /* Insert the scientific names */
         foreach ($matching_ids as $taxon_concept_id => $arr) {
             foreach ($arr as $name_id => $arr2) {
                 foreach ($arr2 as $hierarchy_entry_id => $type) {
                     $preferred = 0;
                     if ($hierarchy_entry_id && $type == "preferred") {
                         $preferred = 1;
                     }
                     fwrite($LOAD_DATA_TEMP, "{$taxon_concept_id}\t{$name_id}\t{$hierarchy_entry_id}\t0\t0\t{$preferred}\n");
                 }
             }
         }
         $mysqli->load_data_infile($tmp_file_path, 'taxon_concept_names');
         unlink($tmp_file_path);
         $tmp_file_path = temp_filepath();
         if (!($LOAD_DATA_TEMP = fopen($tmp_file_path, "w+"))) {
             debug(__CLASS__ . ":" . __LINE__ . ": Couldn't open file: " . $tmp_file_path);
             return;
         }
         /* Insert the common names */
         foreach ($common_names as $taxon_concept_id => $arr) {
             foreach ($arr as $key => $arr2) {
                 $synonym_id = $arr2['synonym_id'];
                 $language_id = $arr2['language_id'];
                 $name_id = $arr2['name_id'];
                 $hierarchy_entry_id = $arr2['hierarchy_entry_id'];
                 $preferred = $arr2['preferred'];
                 $vetted_id = $arr2['vetted_id'];
                 fwrite($LOAD_DATA_TEMP, "{$taxon_concept_id}\t{$name_id}\t{$hierarchy_entry_id}\t{$language_id}\t1\t{$preferred}\t{$synonym_id}\t{$vetted_id}\n");
             }
         }
         $mysqli->load_data_infile($tmp_file_path, 'taxon_concept_names');
         unlink($tmp_file_path);
         unset($matching_ids);
         unset($common_names);
         unset($name_ids);
         unset($preferred_in_language);
         $mysqli->commit();
     }
     if ($started_new_transaction) {
         $mysqli->end_transaction();
     }
 }
コード例 #18
0
ファイル: search_user.php プロジェクト: nikosv/openeclass
//Preparing form data
$usertype_data = array(
    0 => $langAllUsers,
    USER_TEACHER => $langTeacher,
    USER_STUDENT => $langStudent,
    USER_GUEST => $langGuest);
$verified_mail_data = array(
    EMAIL_VERIFICATION_REQUIRED => $m['pending'],
    EMAIL_VERIFIED => $m['yes'],
    EMAIL_UNVERIFIED => $m['no'],
    3 => $langAllUsers);
$authtype_data = $auth_ids;
$authtype_data[0] = $langAllAuthTypes;

$tree = new Hierarchy();
list($js, $html) = $tree->buildNodePicker($depts_defaults);
$head_content .= $js;

// display the search form
$tool_content .= "
<div class='form-wrapper'>
<form class='form-horizontal' role='form' action='listusers.php' method='get' name='user_search'>
<fieldset>
    <div class='form-group'>
        <label for='uname' class='col-sm-2 control-label'>$langUsername:</label>
        <div class='col-sm-10'>
            <input class='form-control' type='text' name='uname' id='uname' value='" . q($uname) . "'>
        </div>
    </div>
    <div class='form-group'>
コード例 #19
0
ファイル: infocours.php プロジェクト: kostastzo/openeclass
 *                  e-mail: info@openeclass.org
 * ======================================================================== */
/**
 * @file infocours.php
 * @brief edit basic course information
 */
$require_departmentmanage_user = true;
require_once '../../include/baseTheme.php';
if (!isset($_GET['c'])) {
    die;
}
require_once 'include/lib/hierarchy.class.php';
require_once 'include/lib/course.class.php';
require_once 'include/lib/user.class.php';
require_once 'hierarchy_validations.php';
$tree = new Hierarchy();
$course = new Course();
$user = new User();
// validate course Id
$cId = course_code_to_id($_GET['c']);
validateCourseNodes($cId, isDepartmentAdmin());
load_js('jstree');
$toolName = $langCourseInfo;
$navigation[] = array('url' => 'index.php', 'name' => $langAdmin);
$navigation[] = array('url' => 'editcours.php?c=' . q($_GET['c']), 'name' => $langCourseEdit);
if (isset($_GET['c'])) {
    $tool_content .= action_bar(array(array('title' => $langBack, 'url' => "editcours.php?c={$_GET['c']}", 'icon' => 'fa-reply', 'level' => 'primary-label')));
} else {
    $tool_content .= action_bar(array(array('title' => $langBackAdmin, 'url' => "index.php", 'icon' => 'fa-reply', 'level' => 'primary-label')));
}
// Update course basic information
コード例 #20
0
ファイル: nodefullpath.php プロジェクト: nikosv/openeclass
 */

require_once '../../include/baseTheme.php';
header('Content-Type: application/json; charset=utf-8');

if (!isset($_REQUEST['nodeid'])) {
    exit();
}

$nodeid = intval($_REQUEST['nodeid']);

if ($nodeid <= 0) {
    exit();
}

require_once 'include/lib/hierarchy.class.php';
$tree = new Hierarchy();
$fullpath = $tree->getFullPath($nodeid);

if (strlen($fullpath) <= 0) {
    exit();
}

$data = array(
    "nodefullpath" => $fullpath
);

echo json_encode($data);
exit();

コード例 #21
0
ファイル: newuser.php プロジェクト: nikosv/openeclass
 * @file newuser.php
 * @brief user registration process
 */

require_once '../../include/baseTheme.php';
require_once 'include/sendMail.inc.php';
require_once 'include/phpass/PasswordHash.php';
require_once 'modules/auth/auth.inc.php';

require_once 'include/lib/user.class.php';
require_once 'include/lib/hierarchy.class.php';
require_once 'modules/admin/custom_profile_fields_functions.php';

$display_captcha = get_config("display_captcha") && function_exists('imagettfbbox');

$tree = new Hierarchy();
$userObj = new User();

load_js('jstree3');
load_js('pwstrength.js');
$head_content .= <<<hContent
<script type="text/javascript">
/* <![CDATA[ */

    var lang = {
hContent;
$head_content .= "pwStrengthTooShort: '" . js_escape($langPwStrengthTooShort) . "', ";
$head_content .= "pwStrengthWeak: '" . js_escape($langPwStrengthWeak) . "', ";
$head_content .= "pwStrengthGood: '" . js_escape($langPwStrengthGood) . "', ";
$head_content .= "pwStrengthStrong: '" . js_escape($langPwStrengthStrong) . "'";
$head_content .= <<<hContent
コード例 #22
0
ファイル: altsearch.php プロジェクト: kostastzo/openeclass
 *                  e-mail: info@openeclass.org
 * ======================================================================== */
/**
 * @file: altsearch.php
 * @authors list: Karatzidis Stratos <*****@*****.**>
 *                 Vagelis Pitsioygas <*****@*****.**>
 * @description: This script/file tries to authenticate the user, using
 * his user/pass pair and the authentication method defined by the admin
 */
require_once '../../include/baseTheme.php';
require_once 'include/sendMail.inc.php';
require_once 'include/CAS/CAS.php';
require_once 'auth.inc.php';
require_once 'include/lib/user.class.php';
require_once 'include/lib/hierarchy.class.php';
$tree = new Hierarchy();
$userObj = new User();
load_js('jstree');
$user_registration = get_config('user_registration');
$alt_auth_stud_reg = get_config('alt_auth_stud_reg');
//user registration via alternative auth methods
$alt_auth_prof_reg = get_config('alt_auth_prof_reg');
// prof registration via alternative auth methods
if (!$user_registration) {
    $tool_content .= "<div class='alert alert-info'>{$langCannotRegister}</div>";
    draw($tool_content, 0);
    exit;
}
if (isset($_POST['auth'])) {
    $auth = intval($_POST['auth']);
    $_SESSION['u_tmp'] = $auth;
コード例 #23
0
 function setUp()
 {
     // Mark test as being run
     $this->originalIsRunningTest = self::$is_running_test;
     self::$is_running_test = true;
     // i18n needs to be set to the defaults or tests fail
     i18n::set_locale(i18n::default_locale());
     i18n::set_date_format(null);
     i18n::set_time_format(null);
     // Remove password validation
     $this->originalMemberPasswordValidator = Member::password_validator();
     $this->originalRequirements = Requirements::backend();
     Member::set_password_validator(null);
     Cookie::set_report_errors(false);
     RootURLController::reset();
     Translatable::reset();
     Versioned::reset();
     DataObject::reset();
     SiteTree::reset();
     Hierarchy::reset();
     if (Controller::has_curr()) {
         Controller::curr()->setSession(new Session(array()));
     }
     $this->originalTheme = SSViewer::current_theme();
     // Save nested_urls state, so we can restore it later
     $this->originalNestedURLsState = SiteTree::nested_urls();
     $className = get_class($this);
     $fixtureFile = eval("return {$className}::\$fixture_file;");
     $prefix = defined('SS_DATABASE_PREFIX') ? SS_DATABASE_PREFIX : 'ss_';
     // Set up fixture
     if ($fixtureFile || $this->usesDatabase || !self::using_temp_db()) {
         if (substr(DB::getConn()->currentDatabase(), 0, strlen($prefix) + 5) != strtolower(sprintf('%stmpdb', $prefix))) {
             //echo "Re-creating temp database... ";
             self::create_temp_db();
             //echo "done.\n";
         }
         singleton('DataObject')->flushCache();
         self::empty_temp_db();
         foreach ($this->requireDefaultRecordsFrom as $className) {
             $instance = singleton($className);
             if (method_exists($instance, 'requireDefaultRecords')) {
                 $instance->requireDefaultRecords();
             }
             if (method_exists($instance, 'augmentDefaultRecords')) {
                 $instance->augmentDefaultRecords();
             }
         }
         if ($fixtureFile) {
             $fixtureFiles = is_array($fixtureFile) ? $fixtureFile : array($fixtureFile);
             $i = 0;
             foreach ($fixtureFiles as $fixtureFilePath) {
                 $fixture = new YamlFixture($fixtureFilePath);
                 $fixture->saveIntoDatabase();
                 $this->fixtures[] = $fixture;
                 // backwards compatibility: Load first fixture into $this->fixture
                 if ($i == 0) {
                     $this->fixture = $fixture;
                 }
                 $i++;
             }
         }
         $this->logInWithPermission("ADMIN");
     }
     // Set up email
     $this->originalMailer = Email::mailer();
     $this->mailer = new TestMailer();
     Email::set_mailer($this->mailer);
     Email::send_all_emails_to(null);
     // Preserve memory settings
     $this->originalMemoryLimit = ini_get('memory_limit');
 }
コード例 #24
0
ファイル: formuser.php プロジェクト: kostastzo/openeclass
 * For a full list of contributors, see "credits.txt".
 *
 * Open eClass is an open platform distributed in the hope that it will
 * be useful (without any warranty), under the terms of the GNU (General
 * Public License) as published by the Free Software Foundation.
 * The full license can be read in "/info/license/license_gpl.txt".
 *
 * Contact address: GUnet Asynchronous eLearning Group,
 *                  Network Operations Center, University of Athens,
 *                  Panepistimiopolis Ilissia, 15784, Athens, Greece
 *                  e-mail: info@openeclass.org
 * ======================================================================== */
include '../../include/baseTheme.php';
include 'include/sendMail.inc.php';
include 'include/lib/hierarchy.class.php';
$tree = new Hierarchy();
load_js('jstree');
$navigation[] = array('url' => 'registration.php', 'name' => $langNewUser);
$prof = isset($_REQUEST['p']) ? intval($_REQUEST['p']) : 0;
$am = !empty($_REQUEST['am']) ? intval($_REQUEST['am']) : '';
$pageName = $prof ? $langReqRegProf : $langUserRequest;
$user_registration = get_config('user_registration');
$eclass_prof_reg = get_config('eclass_prof_reg');
$eclass_stud_reg = get_config('eclass_stud_reg');
// student registration via eclass
// security check
if (!$user_registration) {
    $tool_content .= "<div class='alert alert-danger'>{$langForbidden}</div>";
    draw($tool_content, 0);
    exit;
}
コード例 #25
0
 function flushCache()
 {
     $this->_cache_children = null;
     $this->_cache_numChildren = null;
     self::$marked = array();
     self::$expanded = array();
     self::$treeOpened = array();
 }
コード例 #26
0
ファイル: multiedituser.php プロジェクト: nikosv/openeclass
 * The full license can be read in "/info/license/license_gpl.txt".
 *
 * Contact address: GUnet Asynchronous eLearning Group,
 *                  Network Operations Center, University of Athens,
 *                  Panepistimiopolis Ilissia, 15784, Athens, Greece
 *                  e-mail: info@openeclass.org
 * ======================================================================== */


$require_usermanage_user = TRUE;
include '../../include/baseTheme.php';
require_once 'include/lib/user.class.php';
require_once 'include/lib/hierarchy.class.php';
require_once 'hierarchy_validations.php';

$tree = new Hierarchy();
$user = new User();

if (isset($_POST['activate_submit'])) {
    $toolName = $langAddSixMonths;
} elseif (isset($_POST['move_submit'])) {
    $toolName = $langChangeDepartment;
} else {
    $toolName = $langMultiDelUser;
}
$navigation[] = array('url' => 'index.php', 'name' => $langAdmin);
load_js('tools.js');

if (isset($_POST['submit'])) {
    if (isset($_POST['months'])) {
        $months = intval($_POST['months']);
コード例 #27
0
ファイル: mail_verify.php プロジェクト: nikosv/openeclass
/*
 * User mail verification
 *
 * @author Kapetanakis Giannis <*****@*****.**>
 *
 * @abstract This component verifies user's email address according to the verification code
 *
 */

$mail_ver_excluded = true;
include '../../include/baseTheme.php';
include 'include/sendMail.inc.php';
require_once 'include/lib/hierarchy.class.php';
$pageName = $langMailVerify;
$tree = new Hierarchy();

$code = (isset($_GET['h']) && ctype_xdigit($_GET['h'])) ? $_GET['h'] : NULL;
$req_id = (isset($_GET['rid']) && is_numeric($_GET['rid'])) ? intval($_GET['rid']) : NULL;
$u_id = (isset($_GET['id']) && is_numeric($_GET['id'])) ? intval($_GET['id']) : NULL;

if (!empty($code) and (!empty($u_id) or !empty($req_id))) {
    // user has applied for account
    if (!empty($req_id)) {
        $qry = "SELECT id, username, email, verified_mail, givenname, surname,
                       faculty_id, phone, am, state, status, comment, lang
                    FROM user_request WHERE id = $req_id";
        $id = $req_id;
    }
    // no user application. user account has been created with pending mail verification
    elseif (!empty($u_id)) {
コード例 #28
0
ファイル: opencourses.php プロジェクト: nikosv/openeclass
$countCallback = null;
$isInOpenCoursesMode = (defined('LISTING_MODE') && LISTING_MODE === 'COURSE_METADATA');
$showEmpty = true;

if ($isInOpenCoursesMode) {
    require_once 'modules/course_metadata/CourseXML.php';
    $countCallback = CourseXMLElement::getCountCallback();
    $showEmpty = false;
    // exit if feature disabled
    if (!get_config('opencourses_enable')) {
        header("Location: {$urlServer}");
        exit();
    }
}

$tree = new Hierarchy();

$toolName = $langListCourses;
if ($isInOpenCoursesMode) {
    $navigation[] = array('url' => '../auth/listfaculte.php', 'name' => $langSelectFac);
} else {
    $navigation[] = array('url' => 'listfaculte.php', 'name' => $langSelectFac);
}

if (isset($_GET['fc'])) {
    $fc = intval($_GET['fc']);
}

// parse the faculte id in a session
// This is needed in case the user decides to switch language.
if (isset($fc)) {
コード例 #29
0
ファイル: create_course.php プロジェクト: nikosv/openeclass
$require_help = TRUE;
$helpTopic = 'CreateCourse';

require_once '../../include/baseTheme.php';

if ($session->status !== USER_TEACHER && !$is_departmentmanage_user) { // if we are not teachers or department managers
    redirect_to_home_page();
}

require_once 'include/log.php';
require_once 'include/lib/course.class.php';
require_once 'include/lib/user.class.php';
require_once 'include/lib/hierarchy.class.php';
require_once 'functions.php';

$tree = new Hierarchy();
$course = new Course();
$user = new User();

$toolName = $langCourseCreate;

load_js('jstree3');
load_js('pwstrength.js');

//Datepicker
load_js('tools.js');
load_js('bootstrap-datepicker');

$head_content .= <<<hContent
<script type="text/javascript">
/* <![CDATA[ */
コード例 #30
0
ファイル: multideluser.php プロジェクト: kostastzo/openeclass
 * Open eClass is an open platform distributed in the hope that it will
 * be useful (without any warranty), under the terms of the GNU (General
 * Public License) as published by the Free Software Foundation.
 * The full license can be read in "/info/license/license_gpl.txt".
 *
 * Contact address: GUnet Asynchronous eLearning Group,
 *                  Network Operations Center, University of Athens,
 *                  Panepistimiopolis Ilissia, 15784, Athens, Greece
 *                  e-mail: info@openeclass.org
 * ======================================================================== */
$require_usermanage_user = TRUE;
include '../../include/baseTheme.php';
require_once 'include/lib/user.class.php';
require_once 'include/lib/hierarchy.class.php';
require_once 'hierarchy_validations.php';
$tree = new Hierarchy();
$user = new User();
$toolName = $langMultiDelUser;
$navigation[] = array('url' => 'index.php', 'name' => $langAdmin);
load_js('tools.js');
if (isset($_POST['submit'])) {
    $line = strtok($_POST['user_names'], "\n");
    while ($line !== false) {
        // strip comments
        $line = preg_replace('/#.*/', '', trim($line));
        if (!empty($line)) {
            // fetch uid
            $u = usernameToUid($line);
            // for real uids not equal to admin
            if ($u !== false && $u > 1) {
                // full deletion