Public Member Functions | |
ilPCMediaObjectGUI (&$a_pg_obj, &$a_content_obj, $a_hier_id=0) | |
_forwards () | |
setHeader ($a_title="") | |
getHeader () | |
insert ($a_post_cmd="edpost", $a_submit_cmd="create_mob") | |
insert new media object form | |
& | create ($a_create_alias=true) |
create new media object in dom and update page in db | |
editAlias () | |
edit properties form | |
saveAliasProperties () | |
save table properties in db and return to page edit screen | |
& | executeCommand () |
execute command | |
copyToClipboard () | |
copy media object to clipboard | |
centerAlign () | |
align media object to center | |
leftAlign () | |
align media object to left | |
rightAlign () | |
align media object to right | |
leftFloatAlign () | |
align media object to left, floating text | |
rightFloatAlign () | |
align media object to right, floating text | |
getTabs (&$tab_gui, $a_create=false) | |
add tabs to ilTabsGUI object | |
Data Fields | |
$header | |
$ctrl |
Definition at line 40 of file class.ilPCMediaObjectGUI.php.
ilPCMediaObjectGUI::_forwards | ( | ) |
Definition at line 55 of file class.ilPCMediaObjectGUI.php.
{
return array();
}
ilPCMediaObjectGUI::centerAlign | ( | ) |
align media object to center
Definition at line 628 of file class.ilPCMediaObjectGUI.php.
References $_SESSION, and ilPageContentGUI::getHierId().
{ $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard"); $std_alias_item->setHorizontalAlign("Center"); $_SESSION["il_pg_error"] = $this->pg_obj->update(); $this->ctrl->returnToParent($this, "jump".$this->hier_id); }
ilPCMediaObjectGUI::copyToClipboard | ( | ) |
copy media object to clipboard
Definition at line 617 of file class.ilPCMediaObjectGUI.php.
References sendInfo().
{ $this->ilias->account->addObjectToClipboard($this->content_obj->getId(), $this->content_obj->getType() , $this->content_obj->getTitle()); sendInfo($this->lng->txt("copied_to_clipboard"), true); $this->ctrl->returnToParent($this, "jump".$this->hier_id); }
& ilPCMediaObjectGUI::create | ( | $ | a_create_alias = true |
) |
create new media object in dom and update page in db
Definition at line 110 of file class.ilPCMediaObjectGUI.php.
References $_POST, $file, $title, ilObjMediaObject::_getDirectory(), ilObjMediaObject::_resizeImage(), ilUtil::deducibleSize(), ilObjMediaObject::getMimeType(), insert(), ilUtil::moveUploadedFile(), ilUtil::renameExecutables(), and ilUtil::stripSlashes().
{ // determinte title and format if ($_POST["standard_type"] == "File") { $title = $_FILES['standard_file']['name']; } else { $title = $_POST["standard_reference"]; } // create dummy object in db (we need an id) $this->content_obj = new ilObjMediaObject(); $this->content_obj->setTitle($title); $this->content_obj->setDescription(""); $this->content_obj->create(); // determine and create mob directory, move uploaded file to directory //$mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->content_obj->getId(); $this->content_obj->createDirectory(); $mob_dir = ilObjMediaObject::_getDirectory($this->content_obj->getId()); $media_item =& new ilMediaItem(); $this->content_obj->addMediaItem($media_item); $media_item->setPurpose("Standard"); if ($_POST["standard_type"] == "File") { $file = $mob_dir."/".$_FILES['standard_file']['name']; //move_uploaded_file($_FILES['standard_file']['tmp_name'], $file); if (!ilUtil::moveUploadedFile($_FILES['standard_file']['tmp_name'], $_FILES['standard_file']['name'], $file, false)) { $this->content_obj->delete(); $this->ctrl->returnToParent($this, "jump".$this->hier_id); return; } // get mime type $format = ilObjMediaObject::getMimeType($file); $location = $_FILES['standard_file']['name']; // resize standard images if ($_POST["standard_size"] != "original" && $_POST["standard_resize"] == "y" && is_int(strpos($format, "image"))) { $location = ilObjMediaObject::_resizeImage($file, $_POST["standard_width"], $_POST["standard_height"]); } // set real meta and object data $media_item->setFormat($format); $media_item->setLocation($location); $media_item->setLocationType("LocalFile"); $this->content_obj->setTitle($_FILES['standard_file']['name']); } else // standard type: reference { $format = ilObjMediaObject::getMimeType($_POST["standard_reference"]); $media_item->setFormat($format); $media_item->setLocation($_POST["standard_reference"]); $media_item->setLocationType("Reference"); $this->content_obj->setTitle($_POST["standard_reference"]); } $this->content_obj->setDescription($format); // determine width and height of known image types if ($_POST["standard_size"] == "original") { if (ilUtil::deducibleSize($format)) { $size = getimagesize($file); $media_item->setWidth($size[0]); $media_item->setHeight($size[1]); } else { $media_item->setWidth(500); $media_item->setHeight(400); } } else { $media_item->setWidth($_POST["standard_width"]); $media_item->setHeight($_POST["standard_height"]); } if ($_POST["standard_caption"] != "") { $media_item->setCaption($_POST["standard_caption"]); } if ($_POST["standard_param"] != "") { $media_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["standard_param"]))); } $media_item->setHAlign("Left"); // fullscreen view if ($_POST["fullscreen"] == "y") { $media_item =& new ilMediaItem(); $this->content_obj->addMediaItem($media_item); $media_item->setPurpose("Fullscreen"); // file if ($_POST["full_type"] == "File") { if ($_FILES['full_file']['name'] != "") { $file = $mob_dir."/".$_FILES['full_file']['name']; //move_uploaded_file($_FILES['full_file']['tmp_name'], $file); if (!ilUtil::moveUploadedFile($_FILES['full_file']['tmp_name'], $_FILES['full_file']['name'], $file, false)) { $this->content_obj->delete(); $this->ctrl->returnToParent($this, "jump".$this->hier_id); return; } } if ($_FILES['full_file']['name'] != "" || ($_POST["full_size"] != "original" && $_POST["full_resize"] == "y" && is_int(strpos($format, "image"))) ) { // set real meta and object data $format = ilObjMediaObject::getMimeType($file); $location = $_FILES['full_file']['name']; // resize fullscreen images if ($_POST["full_size"] != "original" && $_POST["full_resize"] == "y" && is_int(strpos($format, "image"))) { $location = ilObjMediaObject::_resizeImage($file, $_POST["full_width"], $_POST["full_height"]); } } $media_item->setFormat($format); $media_item->setLocation($location); $media_item->setLocationType("LocalFile"); } else // reference { if ($_POST["full_reference"] != "") { $format = ilObjMediaObject::getMimeType($_POST["full_reference"]); $media_item->setFormat($format); $media_item->setLocation($_POST["full_reference"]); $media_item->setLocationType("Reference"); } } // determine width and height of known image types if ($_POST["full_size"] == "original") { if (ilUtil::deducibleSize($format)) { $size = getimagesize($file); $media_item->setWidth($size[0]); $media_item->setHeight($size[1]); } else { $media_item->setWidth(500); $media_item->setHeight(400); } } else { $media_item->setWidth($_POST["full_width"]); $media_item->setHeight($_POST["full_height"]); } if ($_POST["full_caption"] != "") { $media_item->setCaption($_POST["full_caption"]); } if ($_POST["full_param"] != "") { $media_item->setParameters(ilUtil::stripSlashes(utf8_decode($_POST["full_param"]))); } } ilUtil::renameExecutables($mob_dir); $this->content_obj->update(); if ($a_create_alias) { $this->content_obj->setDom($this->dom); $this->content_obj->createAlias($this->pg_obj, $this->hier_id); $this->updated = $this->pg_obj->update(); if ($this->updated === true) { $this->ctrl->returnToParent($this, "jump".$this->hier_id); } else { $this->insert(); } } else { return $this->content_obj; } }
ilPCMediaObjectGUI::editAlias | ( | ) |
edit properties form
Definition at line 331 of file class.ilPCMediaObjectGUI.php.
References ilPageContentGUI::displayValidationError(), and ilPageContentGUI::getHierId().
{ //add template for view button $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html"); //$item_nr = $this->content_obj->getMediaItemNr("Standard"); $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard"); $std_item =& $this->content_obj->getMediaItem("Standard"); //echo htmlentities($this->dom->dump_node($std_alias_item->item_node)); // edit media alias template $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mob_alias_properties.html", "content"); $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_edit_mob_alias_prop")); $this->tpl->setVariable("TXT_STANDARD_VIEW", $this->lng->txt("cont_std_view")); $this->tpl->setVariable("TXT_DERIVE", $this->lng->txt("cont_derive_from_obj")); $this->tpl->setVariable("TXT_TYPE", $this->lng->txt("cont_".$std_item->getLocationType())); $this->tpl->setVariable("TXT_LOCATION", $std_item->getLocation()); $this->tpl->setVariable("TXT_FORMAT", $this->lng->txt("cont_format")); $this->tpl->setVariable("VAL_FORMAT", $std_item->getFormat()); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->displayValidationError(); // width $this->tpl->setVariable("TXT_MOB_WIDTH", $this->lng->txt("cont_width")); $this->tpl->setVariable("INPUT_MOB_WIDTH", "mob_width"); $this->tpl->setVariable("VAL_MOB_WIDTH", $std_alias_item->getWidth()); // height $this->tpl->setVariable("TXT_MOB_HEIGHT", $this->lng->txt("cont_height")); $this->tpl->setVariable("INPUT_MOB_HEIGHT", "mob_height"); $this->tpl->setVariable("VAL_MOB_HEIGHT", $std_alias_item->getHeight()); // caption $this->tpl->setVariable("TXT_CAPTION", $this->lng->txt("cont_caption")); $this->tpl->setVariable("INPUT_CAPTION", "mob_caption"); $this->tpl->setVariable("VAL_CAPTION", $std_alias_item->getCaption()); $this->tpl->parseCurrentBlock(); // parameters $this->tpl->setVariable("TXT_PARAMETER", $this->lng->txt("cont_parameter")); $this->tpl->setVariable("INPUT_PARAMETERS", "mob_parameters"); $this->tpl->setVariable("VAL_PARAMETERS", $std_alias_item->getParameterString()); $this->tpl->parseCurrentBlock(); // object default values $this->tpl->setVariable("VAL_OBJ_ST_SIZE", $std_item->getWidth()." / ".$std_item->getHeight()); $this->tpl->setVariable("VAL_OBJ_ST_CAPTION", $std_item->getCaption()); $this->tpl->setVariable("VAL_OBJ_ST_PARAMETERS", $std_item->getParameterString()); if ($std_alias_item->definesSize()) { $this->tpl->setVariable("DERIVE_ST_SIZE_N", "checked=\"1\""); } else { $this->tpl->setVariable("DERIVE_ST_SIZE_Y", "checked=\"1\""); } if ($std_alias_item->definesCaption()) { $this->tpl->setVariable("DERIVE_ST_CAPTION_N", "checked=\"1\""); } else { $this->tpl->setVariable("DERIVE_ST_CAPTION_Y", "checked=\"1\""); } if ($std_alias_item->definesParameters()) { $this->tpl->setVariable("DERIVE_ST_PARAMETER_N", "checked=\"1\""); } else { $this->tpl->setVariable("DERIVE_ST_PARAMETER_Y", "checked=\"1\""); } // fullscreen view if($this->content_obj->hasFullScreenItem()) { $this->tpl->setCurrentBlock("fullscreen"); $full_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Fullscreen"); $full_item =& $this->content_obj->getMediaItem("Fullscreen"); $this->tpl->setVariable("TXT_FULLSCREEN_VIEW", $this->lng->txt("cont_fullscreen")); $this->tpl->setVariable("TXT_FULL_TYPE", $this->lng->txt("cont_".$full_item->getLocationType())); $this->tpl->setVariable("TXT_FULL_LOCATION", $full_item->getLocation()); $this->tpl->setVariable("TXT_FULL_FORMAT", $this->lng->txt("cont_format")); $this->tpl->setVariable("VAL_FULL_FORMAT", $full_item->getFormat()); // width text $this->tpl->setVariable("TXT_FULL_WIDTH", $this->lng->txt("cont_width")); $this->tpl->setVariable("INPUT_FULL_WIDTH", "full_width"); // height text $this->tpl->setVariable("TXT_FULL_HEIGHT", $this->lng->txt("cont_height")); $this->tpl->setVariable("INPUT_FULL_HEIGHT", "full_height"); // caption text $this->tpl->setVariable("TXT_FULL_CAPTION", $this->lng->txt("cont_caption")); $this->tpl->setVariable("INPUT_FULL_CAPTION", "full_caption"); // parameters text $this->tpl->setVariable("TXT_FULL_PARAMETER", $this->lng->txt("cont_parameter")); $this->tpl->setVariable("INPUT_FULL_PARAMETERS", "full_parameters"); // object default values $this->tpl->setVariable("VAL_OBJ_FULL_SIZE", $full_item->getWidth()." / ".$full_item->getHeight()); $this->tpl->setVariable("VAL_OBJ_FULL_CAPTION", $full_item->getCaption()); $this->tpl->setVariable("VAL_OBJ_FULL_PARAMETERS", $full_item->getParameterString()); if ($full_alias_item->definesSize()) { $this->tpl->setVariable("DERIVE_FULL_SIZE_N", "checked=\"1\""); } else { $this->tpl->setVariable("DERIVE_FULL_SIZE_Y", "checked=\"1\""); } if ($full_alias_item->definesCaption()) { $this->tpl->setVariable("DERIVE_FULL_CAPTION_N", "checked=\"1\""); } else { $this->tpl->setVariable("DERIVE_FULL_CAPTION_Y", "checked=\"1\""); } if ($full_alias_item->definesParameters()) { $this->tpl->setVariable("DERIVE_FULL_PARAMETER_N", "checked=\"1\""); } else { $this->tpl->setVariable("DERIVE_FULL_PARAMETER_Y", "checked=\"1\""); } if ($full_alias_item->exists()) { $this->tpl->setVariable("FULLSCREEN_CHECKED", "checked=\"1\""); // width $this->tpl->setVariable("VAL_FULL_WIDTH", $full_alias_item->getWidth()); // height $this->tpl->setVariable("VAL_FULL_HEIGHT", $full_alias_item->getHeight()); // caption $this->tpl->setVariable("VAL_FULL_CAPTION", $full_alias_item->getCaption()); // parameters $this->tpl->setVariable("VAL_FULL_PARAMETERS", $full_alias_item->getParameterString()); } $this->tpl->parseCurrentBlock(); } // operations $this->tpl->setCurrentBlock("commands"); $this->tpl->setVariable("BTN_NAME", "saveAliasProperties"); $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save")); $this->tpl->parseCurrentBlock(); }
& ilPCMediaObjectGUI::executeCommand | ( | ) |
ilPCMediaObjectGUI::getHeader | ( | ) |
Definition at line 65 of file class.ilPCMediaObjectGUI.php.
{
return $this->header;
}
ilPCMediaObjectGUI::getTabs | ( | &$ | tab_gui, | |
$ | a_create = false | |||
) |
add tabs to ilTabsGUI object
object | $tab_gui ilTabsGUI object | |
boolean | $a_create new creation true/false |
Definition at line 686 of file class.ilPCMediaObjectGUI.php.
References $ilCtrl.
{ global $ilCtrl; if ($a_create) { /* $tab_gui->addTarget("cont_back", $ilCtrl->getParentReturn($this), "", ""); */ } else { $tab_gui->addTarget("cont_mob_inst_prop", $ilCtrl->getLinkTarget($this, "editAlias"), "editAlias", get_class($this)); } }
ilPCMediaObjectGUI::ilPCMediaObjectGUI | ( | &$ | a_pg_obj, | |
&$ | a_content_obj, | |||
$ | a_hier_id = 0 | |||
) |
Definition at line 45 of file class.ilPCMediaObjectGUI.php.
References $ilCtrl, and ilPageContentGUI::ilPageContentGUI().
{ global $ilCtrl; $this->ctrl =& $ilCtrl; //echo "constructor target:".$_SESSION["il_map_il_target"].":<br>"; parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id); }
ilPCMediaObjectGUI::insert | ( | $ | a_post_cmd = "edpost" , |
|
$ | a_submit_cmd = "create_mob" | |||
) |
insert new media object form
Definition at line 74 of file class.ilPCMediaObjectGUI.php.
References ilPageContentGUI::displayValidationError().
Referenced by create().
{ $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mob_new.html", "content"); $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_insert_mob")); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->displayValidationError(); // select fields for number of columns $this->tpl->setVariable("TXT_STANDARD_VIEW", $this->lng->txt("cont_std_view")); $this->tpl->setVariable("TXT_FILE", $this->lng->txt("cont_file")); $this->tpl->setVariable("TXT_REFERENCE", $this->lng->txt("cont_Reference")); $this->tpl->setVariable("TXT_REF_HELPTEXT", $this->lng->txt("cont_ref_helptext")); $this->tpl->setVariable("TXT_WIDTH", $this->lng->txt("cont_width")); $this->tpl->setVariable("TXT_HEIGHT", $this->lng->txt("cont_height")); $this->tpl->setVariable("TXT_ORIGINAL_SIZE", $this->lng->txt("cont_orig_size")); $this->tpl->setVariable("TXT_CAPTION", $this->lng->txt("cont_caption")); $this->tpl->setVariable("TXT_FULLSCREEN_VIEW", $this->lng->txt("cont_fullscreen")); $this->tpl->setVariable("TXT_PARAMETER", $this->lng->txt("cont_parameter")); $this->tpl->setVariable("TXT_RESIZE", $this->lng->txt("cont_resize_image")); $this->tpl->setVariable("TXT_RESIZE_EXPLANATION", $this->lng->txt("cont_resize_explanation")); $this->tpl->parseCurrentBlock(); // operations $this->tpl->setCurrentBlock("commands"); $this->tpl->setVariable("BTN_NAME", $a_submit_cmd); $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save")); $this->tpl->setVariable("BTN_CANCEL", "cancelCreate"); $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel")); $this->tpl->parseCurrentBlock(); }
ilPCMediaObjectGUI::leftAlign | ( | ) |
align media object to left
Definition at line 639 of file class.ilPCMediaObjectGUI.php.
References $_SESSION, and ilPageContentGUI::getHierId().
{ $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard"); $std_alias_item->setHorizontalAlign("Left"); $_SESSION["il_pg_error"] = $this->pg_obj->update(); $this->ctrl->returnToParent($this, "jump".$this->hier_id); }
ilPCMediaObjectGUI::leftFloatAlign | ( | ) |
align media object to left, floating text
Definition at line 661 of file class.ilPCMediaObjectGUI.php.
References $_SESSION, and ilPageContentGUI::getHierId().
{ $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard"); $std_alias_item->setHorizontalAlign("LeftFloat"); $_SESSION["il_pg_error"] = $this->pg_obj->update(); $this->ctrl->returnToParent($this, "jump".$this->hier_id); }
ilPCMediaObjectGUI::rightAlign | ( | ) |
align media object to right
Definition at line 650 of file class.ilPCMediaObjectGUI.php.
References $_SESSION, and ilPageContentGUI::getHierId().
{ $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard"); $std_alias_item->setHorizontalAlign("Right"); $_SESSION["il_pg_error"] = $this->pg_obj->update(); $this->ctrl->returnToParent($this, "jump".$this->hier_id); }
ilPCMediaObjectGUI::rightFloatAlign | ( | ) |
align media object to right, floating text
Definition at line 672 of file class.ilPCMediaObjectGUI.php.
References $_SESSION, and ilPageContentGUI::getHierId().
{ $std_alias_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard"); $std_alias_item->setHorizontalAlign("RightFloat"); $_SESSION["il_pg_error"] = $this->pg_obj->update(); $this->ctrl->returnToParent($this, "jump".$this->hier_id); }
ilPCMediaObjectGUI::saveAliasProperties | ( | ) |
save table properties in db and return to page edit screen
Definition at line 495 of file class.ilPCMediaObjectGUI.php.
References $_POST, ilUtil::extractParameterString(), ilPageContentGUI::getHierId(), and ilUtil::stripSlashes().
{ $std_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard"); $full_item =& new ilMediaAliasItem($this->dom, $this->getHierId(), "Fullscreen"); // standard size if($_POST["derive_st_size"] == "y") { $std_item->deriveSize(); } else { $std_item->setWidth($_POST["mob_width"]); $std_item->setHeight($_POST["mob_height"]); } // standard caption if($_POST["derive_st_caption"] == "y") { $std_item->deriveCaption(); } else { $std_item->setCaption($_POST["mob_caption"]); } // standard parameters if($_POST["derive_st_parameter"] == "y") { $std_item->deriveParameters(); } else { $std_item->setParameters(ilUtil::extractParameterString(ilUtil::stripSlashes(utf8_decode($_POST["mob_parameters"])))); } if($this->content_obj->hasFullscreenItem()) { if ($_POST["fullscreen"] == "y") { if (!$full_item->exists()) { $full_item->insert(); } // fullscreen size if($_POST["derive_full_size"] == "y") { $full_item->deriveSize(); } else { $full_item->setWidth($_POST["full_width"]); $full_item->setHeight($_POST["full_height"]); } // fullscreen caption if($_POST["derive_full_caption"] == "y") { $full_item->deriveCaption(); } else { $full_item->setCaption($_POST["full_caption"]); } // fullscreen parameters if($_POST["derive_full_parameter"] == "y") { $full_item->deriveParameters(); } else { $full_item->setParameters(ilUtil::extractParameterString(ilUtil::stripSlashes(utf8_decode($_POST["full_parameters"])))); } } else { if ($full_item->exists()) { $full_item->delete(); } } } $this->updated = $this->pg_obj->update(); if ($this->updated === true) { $this->ctrl->returnToParent($this, "jump".$this->hier_id); } else { $this->pg_obj->addHierIDs(); $this->edit(); } }
ilPCMediaObjectGUI::setHeader | ( | $ | a_title = "" |
) |
Definition at line 60 of file class.ilPCMediaObjectGUI.php.
{ $this->header = $a_title; }
ilPCMediaObjectGUI::$ctrl |
Reimplemented from ilPageContentGUI.
Definition at line 43 of file class.ilPCMediaObjectGUI.php.
ilPCMediaObjectGUI::$header |
Definition at line 42 of file class.ilPCMediaObjectGUI.php.