Source for file layout_profile.php
Documentation is available at layout_profile.php
// This file is part of the Sloodle project (www.sloodle.org)
* This file defines structures for managing Sloodle layout profiles.
* @copyright Copyright (c) 2008 Sloodle (various contributors)
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU GPL v3
* @contributor Peter R. Bloomfield
$this->originalentries =
$this->get_entries($store =
false);
$rec =
get_record('sloodle_layout','id',$id);
for ($i=
0; $i<
count($entries); $i++
) {
if ( ($entry->objectuuid !=
null) &&
($entry->objectuuid !=
'') ) {
$entry->populate_from_active_object();
return get_record('course','id',$this->courseid);
// return a set of SloodleLayoutEntry objects for the layout.
// store parameter indicates whether they should be stored as instance variables.
// set $store=false if you're planning to update the object entries and you're only reading them in so the object will know what is already there and what to insert and delete.
$rows =
get_records('sloodle_layout_entry','layout',$this->id);
//print "<h4>layout.get_entries returning ".count($entries)."entries</h4>";
$this->id =
insert_record('sloodle_layout', $this);
if (!update_record('sloodle_layout', $this)) {
foreach($this->entries as $entry) {
$entry->layout =
$this->id;
$entry->id =
$entry->insert();
$neededids[] =
$entry->id;
foreach($this->originalentries as $entry) {
* Stores data for a single entry in a layout profile.
* Used with {@link SloodleCourse}
* The name of the object this entry represents.
* The position of the object, as a 3d vector, in string format "<x,y,z>"
* The rotation of the object, as a 3d vector of Euler angles, in string format "<x,y,z>"
$this->objectuuid =
$r->objectuuid; // not saved - just used to populate defaults
$this->originalconfigs =
$this->configs; // save the original configs so we know what to delete, what to update and what to add
$rec =
get_record('sloodle_layout_entry', 'id', $id);
if (!$objectuuid =
$this->objectuuid) {
$object =
get_record('sloodle_active_object','uuid',$this->objectuuid);
$object_id =
$object->id;
if (!$object_id) return false;
$configs =
get_records('sloodle_object_config','object',$object_id);
foreach($configs as $config) {
if ( $layout->load($this->layout) ) {
* Return an array of layout_entry_config objects
* @param integer $layout_entry_id The ID of the layout entry
* @return array Array if successful (empty if there are no entries) , or null otherwise
$recs =
get_records('sloodle_layout_entry_config', 'layout_entry', $this->id);
// Construct the array of SloodleLayoutEntry objects
$fieldname =
$prefix.
$n.
$suffix;
$str .=
'<input type="hidden" name="'.
$fieldname.
'" value="'.
$v.
'" />';
$configs[$obj->name] =
$obj->value;
* Sets the position as separate X,Y,Z components
* @param float $x The X component to set
* @param float $y The Y component to set
* @param float $z The Z component to set
* Sets the rotation as separate X,Y,Z components
* @param float $x The X component to set
* @param float $y The Y component to set
* @param float $z The Z component to set
function set_config($name, $value) { // add config with given name/value, overwriting if necessary
for( $i=
0; $i<
count($configs); $i++
) {
if ($config->name ==
$name) {
$config->layout_entry =
$this->id;
$this->id =
insert_record('sloodle_layout_entry', $this);
if (!update_record('sloodle_layout_entry', $this)) {
if (!$this->id) return false;
$result =
delete_records('sloodle_layout_entry', 'id', $this->id);
return delete_records('sloodle_layout_entry_config', 'layout_entry', $this->id);
foreach($this->configs as $config) {
$config->layout_entry =
$this->id;
$entry_id =
$config->insert();
$this->name =
$row->name;
$this->value =
$row->value;
$rec =
get_record('sloodle_layout_entry_config', 'id', $id);
return $this->id =
insert_record('sloodle_layout_entry_config', $this);
return update_record('sloodle_layout_entry_config', $this);
Documentation generated on Fri, 17 Jul 2009 11:01:32 +0100 by phpDocumentor 1.4.0