June 5, 2016♦
<?php
require_once "../account/get_user_path.php";
$GLOBALS["FILE_NAME"] = "expert";
print_expert_list();
function print_expert_list()
{
$path = account\get_user_path() . $GLOBALS["FILE_NAME"];
echo file_get_contents($path);
}
<?php
require_once "../account/get_user_path.php";
$GLOBALS["ALBUM_PATH"] = "../../../../../img/album/";
$GLOBALS["PROGRESS_FILE_NAME"] = "progress";
print_file_names();
function print_file_names()
{
$progress = get_progress();
$ii = 0;
foreach (scandir($GLOBALS["ALBUM_PATH"]) as $file_name)
{
if ($file_name[0] != ".")
{
echo "$file_name\n";
$ii++;
}
if ($ii >= $progress)
{
break;
}
}
}
function get_progress()
{
$path = account\get_user_path() . $GLOBALS["PROGRESS_FILE_NAME"];
return file_get_contents($path, FILE_IGNORE_NEW_LINES);
}
EVR.include("album/Menu.js");
EVR.include("album/grid/Grid.js");
EVR.include("album/Page.js");
EVR.include("album/Availability.js");
EVR.Album = function(container)
{
EVR.Graphic.call(this, container, null, null, ALIGN_CENTER);
this.set_attributes();
this.index = 0;
this.initialize_pages();
this.add_pages();
this.availability = new EVR.Album.Availability();
this.menu = new EVR.Album.Menu(this);
this.grid = new EVR.Album.Grid(this.element);
}
EVR.Album.prototype = new EVR.Graphic;
EVR.Album.prototype.set_attributes = function()
{
this.set_color(ALBUM_BACKGROUND);
this.set_z(ALBUM_Z_INDEX);
}
EVR.Album.prototype.shape = function()
{
this.css.width = "100%";
this.css.height = "100%";
}
EVR.Album.prototype.initialize_pages = function()
{
this.pages = [];
}
EVR.Album.prototype.add_pages = function()
{
var pages = this.pages;
var container = this.container;
var script = SOURCE_PATH + "album/list_image_paths.php";
var paths = new EVR.Requester(script, null, true).execute().split("\n");
for (var ii = pages.length; ii < paths.length - 1; ii++)
{
pages.push(new EVR.Album.Page(paths[ii], this.element));
}
}
EVR.Album.prototype.refresh = function(index)
{
var grid = this.grid;
if (grid.visible && !this.grid_available())
{
grid.toggle();
}
this.add_pages();
if (index != null)
{
this.index = index;
}
this.pages[this.index].show();
this.menu.update();
}
EVR.Album.prototype.grid_available = function()
{
var level = this.index + 1;
return this.availability.is_available(level);
}
EVR.Album.prototype.next = function()
{
this.pages[this.index].hide();
this.increment_index();
this.refresh();
}
EVR.Album.prototype.increment_index = function()
{
var index = this.index;
index++;
if (index >= this.pages.length)
{
index = 0;
}
this.index = index;
}
EVR.Album.prototype.previous = function()
{
this.pages[this.index].hide();
this.decrement_index();
this.refresh();
}
EVR.Album.prototype.decrement_index = function()
{
var index = this.index;
index--;
if (index < 0)
{
index = this.pages.length - 1;
}
this.index = index;
}
EVR.Album.prototype.toggle_menu = function()
{
this.menu.toggle();
}
EVR.Album.prototype.count = function()
{
return this.pages.length;
}
EVR.Album.prototype.toggle_grid = function()
{
if (this.grid_available())
{
this.grid.toggle();
}
}
EVR.Album.prototype.append = function(index)
{
this.availability.update();
this.refresh(index);
EVR.Graphic.prototype.append.call(this);
}
EVR.Album.prototype.remove = function()
{
this.hide_children();
EVR.Graphic.prototype.remove.call(this);
}
EVR.Album.prototype.hide_children = function()
{
var menu = this.menu;
var grid = this.grid;
this.pages[this.index].hide();
menu.visible && menu.hide();
grid.visible && grid.hide();
}
EVR.Album.prototype.toString = function()
{
return "[object EVR.Album]";
}
EVR.Album.Availability = function()
{
this.build_list();
}
EVR.Album.Availability.prototype.build_list = function()
{
var script = SOURCE_PATH + "album/fetch_expert_list.php";
this.list = new EVR.Requester(script, null, true).execute().split(" ");
}
EVR.Album.Availability.prototype.update = function()
{
this.build_list();
}
EVR.Album.Availability.prototype.is_available = function(level)
{
var list = this.list;
for (var ii = 0; ii < list.length; ii++)
{
if (list[ii] == level)
{
return true;
}
}
return false;
}
EVR.Album.Availability.prototype.toString = function()
{
return "[object EVR.Album.Availability]";
}