本文整理汇总了PHP中ilObject::_isInTrash方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObject::_isInTrash方法的具体用法?PHP ilObject::_isInTrash怎么用?PHP ilObject::_isInTrash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObject
的用法示例。
在下文中一共展示了ilObject::_isInTrash方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildRef
/**
* @param $id
* @param $type
*
* @return bool|int
*/
protected function buildRef($id, $type)
{
if ($type == 'reference_id') {
if (!ilObjOrgUnit::_exists($id, true)) {
return false;
}
return $id;
} elseif ($type == 'external_id') {
$obj_id = ilObject::_lookupObjIdByImportId($id);
if (!ilObject::_hasUntrashedReference($obj_id)) {
return false;
}
$ref_ids = ilObject::_getAllReferences($obj_id);
if (!count($ref_ids)) {
return false;
}
foreach ($ref_ids as $ref_id) {
if (!ilObject::_isInTrash($ref_id)) {
return $ref_id;
}
}
return false;
} else {
return false;
}
}
示例2: handlerBeginTag
/**
* handler for begin of element
*
* @param resource $a_xml_parser xml parser
* @param string $a_name element name
* @param array $a_attribs element attributes array
*/
function handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
{
global $objDefinition, $ilAccess, $tree;
switch ($a_name) {
case 'Settings':
$this->options = array();
$this->source_id = (int) $a_attribs["source_id"];
if (ilObject::_isInTrash($this->source_id)) {
throw new ilSaxParserException("Source id " . $this->source_id . " is in trash");
}
$this->target_id = (int) $a_attribs["target_id"];
if (ilObject::_isInTrash($this->target_id)) {
throw new ilSaxParserException("target id" . $this->target_id . " is in trash");
}
$this->default_action = ilCopyWizardSettingsXMLParser::getActionForString($a_attribs["default_action"]);
break;
case 'Option':
$id = (int) $a_attribs["id"];
if (ilObject::_isInTrash($id)) {
throw new ilSaxParserException("Id {$id} is in trash");
}
if (!$tree->isInTree($id)) {
throw new ilSaxParserException("Id {$id} does not exist");
}
$action = ilCopyWizardSettingsXMLParser::getActionForString($a_attribs["action"]);
$type = ilObjectFactory::getTypeByRefId($id);
switch ($action) {
case ilCopyWizardOptions::COPY_WIZARD_COPY:
$perm_copy = $ilAccess->checkAccess('copy', '', $id);
$copy = $objDefinition->allowCopy($type);
if ($perm_copy && $copy) {
$this->options[$id] = array("type" => $action);
} elseif ($copy && !$perm_copy) {
throw new ilSaxParserException("Missing copy permission for object " . $id);
} elseif (!$copy) {
throw new ilSaxParserException("Copy for object " . $id . " of type " . $type . " is not supported");
}
break;
case ilCopyWizardOptions::COPY_WIZARD_LINK:
$perm_link = $ilAccess->checkAccess('write', '', $id);
$link = $objDefinition->allowLink($type);
if ($perm_link && $link) {
$this->options[$id] = array("type" => $action);
} elseif ($copy && !$perm_link) {
throw new ilSaxParserException("Missing write permission for object " . $id);
} elseif (!$link) {
throw new ilSaxParserException("Link for object " . $id . " of type " . $type . " is not supported");
}
break;
}
}
}
示例3: getTestResults
/**
* get results of test
*
* @param string $sid
* @param int $test_ref_id
* @param boolean $sum_only
*
* @return XMLResultSet with columns
* sum only = true: user_id, login, firstname, lastname, matriculation, maximum points, received points
* sum only = false: user_id, login, firstname, lastname, matriculation, question id, question title, question points, received points
*/
function getTestResults($sid, $test_ref_id, $sum_only)
{
$this->initAuth($sid);
$this->initIlias();
if (!$this->__checkSession($sid)) {
return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
}
if (!strlen($test_ref_id)) {
return $this->__raiseError('No test id given. Aborting!', 'Client');
}
global $rbacsystem, $tree, $ilLog;
if (ilObject::_isInTrash($test_ref_id)) {
return $this->__raiseError('Test is trashed. Aborting!', 'Client');
}
// get obj_id
if (!($obj_id = ilObject::_lookupObjectId($test_ref_id))) {
return $this->__raiseError('No test found for id: ' . $test_ref_id, 'Client');
}
// Check access
$permission_ok = false;
foreach ($ref_ids = ilObject::_getAllReferences($obj_id) as $ref_id) {
if ($rbacsystem->checkAccess('write', $ref_id)) {
$permission_ok = true;
break;
}
}
if (!$permission_ok) {
return $this->__raiseError('No permission to edit the object with id: ' . $test_ref_id, 'Server');
}
// store into xml result set
include_once './webservice/soap/classes/class.ilXMLResultSet.php';
include_once './webservice/soap/classes/class.ilXMLResultSetWriter.php';
$xmlResultSet = new ilXMLResultSet();
$xmlResultSet->addColumn("user_id");
$xmlResultSet->addColumn("login");
$xmlResultSet->addColumn("firstname");
$xmlResultSet->addColumn("lastname");
$xmlResultSet->addColumn("matriculation");
include_once './Modules/Test/classes/class.ilObjTest.php';
$test_obj = new ilObjTest($obj_id, false);
$participants = $test_obj->getTestParticipants();
if ($sum_only) {
$data = $test_obj->getAllTestResults($participants, false);
// create xml
$xmlResultSet->addColumn("maximum_points");
$xmlResultSet->addColumn("received_points");
// skip titles
$titles = array_shift($data);
foreach ($data as $row) {
$xmlRow = new ilXMLResultSetRow();
$xmlRow->setValue(0, $row["user_id"]);
$xmlRow->setValue(1, $row["login"]);
$xmlRow->setValue(2, $row["firstname"]);
$xmlRow->setValue(3, $row["lastname"]);
$xmlRow->setValue(4, $row["matriculation"]);
$xmlRow->setValue(5, $row["max_points"]);
$xmlRow->setValue(6, $row["reached_points"]);
$xmlResultSet->addRow($xmlRow);
}
} else {
$data = $test_obj->getDetailedTestResults($participants);
// create xml
$xmlResultSet->addColumn("question_id");
$xmlResultSet->addColumn("question_title");
$xmlResultSet->addColumn("maximum_points");
$xmlResultSet->addColumn("received_points");
foreach ($data as $row) {
$xmlRow = new ilXMLResultSetRow();
$xmlRow->setValue(0, $row["user_id"]);
$xmlRow->setValue(1, $row["login"]);
$xmlRow->setValue(2, $row["firstname"]);
$xmlRow->setValue(3, $row["lastname"]);
$xmlRow->setValue(4, $row["matriculation"]);
$xmlRow->setValue(5, $row["question_id"]);
$xmlRow->setValue(6, $row["question_title"]);
$xmlRow->setValue(7, $row["max_points"]);
$xmlRow->setValue(8, $row["reached_points"]);
$xmlResultSet->addRow($xmlRow);
}
}
// create writer
$xmlWriter = new ilXMLResultSetWriter($xmlResultSet);
$xmlWriter->start();
return $xmlWriter->getXML();
}
示例4: getPathForRefId
function getPathForRefId($sid, $ref_id)
{
$this->initAuth($sid);
$this->initIlias();
if (!$this->__checkSession($sid)) {
return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
}
global $ilAccess, $objDefinition, $rbacsystem, $lng, $ilUser;
if (!$rbacsystem->checkAccess('read', $ref_id)) {
return $this->__raiseError("Missing read permissions for object with reference id " . $ref_id, 'Client');
}
if (ilObject::_isInTrash($ref_id)) {
return $this->__raiseError("Object is in Trash", 'Client');
}
global $tree, $lng;
$items = $tree->getPathFull($ref_id);
include_once 'webservice/soap/classes/class.ilXMLResultSet.php';
include_once 'webservice/soap/classes/class.ilXMLResultSetWriter.php';
include_once 'Modules/Course/classes/class.ilCourseXMLWriter.php';
$xmlResultSet = new ilXMLResultSet();
$xmlResultSet->addColumn("ref_id");
$xmlResultSet->addColumn("type");
$xmlResultSet->addColumn("title");
$writer = new ilXMLResultSetWriter($xmlResultSet);
foreach ($items as $item) {
if ($item["ref_id"] == $ref_id) {
continue;
}
if ($item["title"] == "ILIAS" && $item["type"] == "root") {
$item["title"] = $lng->txt("repository");
}
$row = new ilXMLResultSetRow();
$xmlResultSet->addRow($row);
$row->setValue("ref_id", $item["ref_id"]);
$row->setValue("type", $item["type"]);
$row->setValue("title", $item["title"]);
}
$writer->start();
return $writer->getXML();
}
示例5: _hasUntrashedReference
/**
* checks wether an object has at least one reference that is not in trash
*/
function _hasUntrashedReference($a_obj_id)
{
$ref_ids = ilObject::_getAllReferences($a_obj_id);
foreach ($ref_ids as $ref_id) {
if (!ilObject::_isInTrash($ref_id)) {
return true;
}
}
return false;
}
示例6: getGroupsForUser
/**
* get groups which belong to a specific user, fullilling the status
*
* @param string $sid
* @param string $parameters following xmlresultset, columns (user_id, status with values 1 = "MEMBER", 2 = "TUTOR", 4 = "ADMIN", 8 = "OWNER" and any xor operation e.g. 1 + 4 = 5 = ADMIN and TUTOR, 7 = ADMIN and TUTOR and MEMBER)
* @param string XMLResultSet, columns (ref_id, xml, parent_ref_id)
*/
function getGroupsForUser($sid, $parameters)
{
$this->initAuth($sid);
$this->initIlias();
if (!$this->__checkSession($sid)) {
return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
}
global $rbacreview, $ilObjDataCache, $tree;
include_once 'webservice/soap/classes/class.ilXMLResultSetParser.php';
$parser = new ilXMLResultSetParser($parameters);
try {
$parser->startParsing();
} catch (ilSaxParserException $exception) {
return $this->__raiseError($exception->getMessage(), "Client");
}
$xmlResultSet = $parser->getXMLResultSet();
if (!$xmlResultSet->hasColumn("user_id")) {
return $this->__raiseError("parameter user_id is missing", "Client");
}
if (!$xmlResultSet->hasColumn("status")) {
return $this->__raiseError("parameter status is missing", "Client");
}
$user_id = (int) $xmlResultSet->getValue(0, "user_id");
$status = (int) $xmlResultSet->getValue(0, "status");
$ref_ids = array();
// get roles
#var_dump($xmlResultSet);
#echo "uid:".$user_id;
#echo "status:".$status;
if (ilSoapGroupAdministration::MEMBER == ($status & ilSoapGroupAdministration::MEMBER) || ilSoapGroupAdministration::ADMIN == ($status & ilSoapGroupAdministration::ADMIN)) {
foreach ($rbacreview->assignedRoles($user_id) as $role_id) {
if ($role = ilObjectFactory::getInstanceByObjId($role_id, false)) {
#echo $role->getType();
if ($role->getType() != "role") {
continue;
}
if ($role->getParent() == ROLE_FOLDER_ID) {
continue;
}
$role_title = $role->getTitle();
if ($ref_id = ilUtil::__extractRefId($role_title)) {
if (!ilObject::_exists($ref_id, true) || ilObject::_isInTrash($ref_id)) {
continue;
}
#echo $role_title;
if (ilSoapGroupAdministration::MEMBER == ($status & ilSoapGroupAdministration::MEMBER) && strpos($role_title, "member") !== false) {
$ref_ids[] = $ref_id;
} elseif (ilSoapGroupAdministration::ADMIN == ($status & ilSoapGroupAdministration::ADMIN) && strpos($role_title, "admin") !== false) {
$ref_ids[] = $ref_id;
}
}
}
}
}
if (($status & ilSoapGroupAdministration::OWNER) == ilSoapGroupAdministration::OWNER) {
$owned_objects = ilObjectFactory::getObjectsForOwner("grp", $user_id);
foreach ($owned_objects as $obj_id) {
$allrefs = ilObject::_getAllReferences($obj_id);
$refs = array();
foreach ($allrefs as $r) {
if ($tree->isDeleted($r)) {
continue;
}
if ($tree->isInTree($r)) {
$refs[] = $r;
}
}
if (count($refs) > 0) {
$ref_ids[] = array_pop($refs);
}
}
}
$ref_ids = array_unique($ref_ids);
#print_r($ref_ids);
include_once 'webservice/soap/classes/class.ilXMLResultSetWriter.php';
include_once 'Modules/Group/classes/class.ilObjGroup.php';
include_once 'Modules/Group/classes/class.ilGroupXMLWriter.php';
$xmlResultSet = new ilXMLResultSet();
$xmlResultSet->addColumn("ref_id");
$xmlResultSet->addColumn("xml");
$xmlResultSet->addColumn("parent_ref_id");
foreach ($ref_ids as $group_id) {
$group_obj = $this->checkObjectAccess($group_id, "grp", "write", true);
if ($group_obj instanceof ilObjGroup) {
$row = new ilXMLResultSetRow();
$row->setValue("ref_id", $group_id);
$xmlWriter = new ilGroupXMLWriter($group_obj);
$xmlWriter->setAttachUsers(false);
$xmlWriter->start();
$row->setValue("xml", $xmlWriter->getXML());
$row->setValue("parent_ref_id", $tree->getParentId($group_id));
$xmlResultSet->addRow($row);
}
//.........这里部分代码省略.........
示例7: hasSCORMCertificate
public function hasSCORMCertificate($sid, $ref_id, $usr_id)
{
$this->initAuth($sid);
$this->initIlias();
if (!$this->__checkSession($sid)) {
return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
}
if (!strlen($ref_id)) {
return $this->__raiseError('No ref id given. Aborting!', 'Client');
}
global $rbacsystem, $tree, $ilLog;
// get obj_id
if (!($obj_id = ilObject::_lookupObjectId($ref_id))) {
return $this->__raiseError('No exercise found for id: ' . $ref_id, 'Client');
}
if (ilObject::_isInTrash($ref_id)) {
return $this->__raiseError("Parent with ID {$ref_id} has been deleted.", 'Client');
}
$result = false;
include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php";
$result = ilObjSAHSLearningModuleAccess::_lookupUserCertificate($obj_id, $usr_id);
return $result;
}
示例8: testTreeTrash
public function testTreeTrash()
{
global $tree;
$obj = new ilObject();
$obj->setType("xxx");
$obj->setTitle("TestObject");
$obj->setDescription("TestDescription");
$obj->setImportId("imp_44");
$obj->create();
$obj->createReference();
$id = $obj->getId();
$ref_id = $obj->getRefId();
$obj = new ilObject($ref_id);
$obj->putInTree(ROOT_FOLDER_ID);
$obj->createRoleFolder();
$obj->setPermissions(ROOT_FOLDER_ID);
if ($tree->isInTree($ref_id)) {
$value .= "tree1-";
}
if (ilObject::_hasUntrashedReference($id)) {
$value .= "tree2-";
}
// isSaved() uses internal cache!
$tree->useCache(false);
$tree->saveSubTree($ref_id, true);
if ($tree->isDeleted($ref_id)) {
$value .= "tree3-";
}
if ($tree->isSaved($ref_id)) {
$value .= "tree4-";
}
if (ilObject::_isInTrash($ref_id)) {
$value .= "tree5-";
}
if (!ilObject::_hasUntrashedReference($id)) {
$value .= "tree6-";
}
$saved_tree = new ilTree(-(int) $ref_id);
$node_data = $saved_tree->getNodeData($ref_id);
$saved_tree->deleteTree($node_data);
if (!ilObject::_isInTrash($ref_id)) {
$value .= "tree7-";
}
$obs = ilUtil::_getObjectsByOperations("cat", "read");
foreach ($obs as $ob) {
if (ilObject::_lookupType(ilObject::_lookupObjId($ob)) != "cat") {
$value .= "nocat-";
}
}
$obj->delete();
$this->assertEquals("tree1-tree2-tree3-tree4-tree5-tree6-tree7-", $value);
}
示例9: recurseFolder
/**
* private functions which iterates through all folders and files
* and create an according file structure in a temporary directory. This function works recursive.
*
* @param integer $refid reference it
* @param tmpdictory $tmpdir
* @return returns first created directory
*/
private static function recurseFolder($refid, $title, $tmpdir)
{
global $rbacsystem, $tree, $ilAccess;
$tmpdir = $tmpdir . DIRECTORY_SEPARATOR . ilUtil::getASCIIFilename($title);
ilUtil::makeDir($tmpdir);
$subtree = $tree->getChildsByTypeFilter($refid, array("fold", "file"));
foreach ($subtree as $child) {
if (!$ilAccess->checkAccess("read", "", $child["ref_id"])) {
continue;
}
if (ilObject::_isInTrash($child["ref_id"])) {
continue;
}
if ($child["type"] == "fold") {
self::recurseFolder($child["ref_id"], $child["title"], $tmpdir);
} else {
self::copyFile($child["obj_id"], $child["title"], $tmpdir);
}
}
}
示例10: editLevelTrigger
/**
* Edit level trigger
*/
function editLevelTrigger()
{
global $lng, $ilCtrl, $tpl, $ilTabs;
$this->setLevelHead();
$ilTabs->activateTab("level_trigger");
$trigger = ilBasicSkill::lookupLevelTrigger((int) $_GET["level_id"]);
if (ilObject::_lookupType($trigger["obj_id"]) != "crs" || ilObject::_isInTrash($trigger["ref_id"])) {
$trigger = array();
}
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$this->form = new ilPropertyFormGUI();
// trigger
$ne = new ilNonEditableValueGUI($lng->txt("skmg_trigger"), "trigger");
if ($trigger["obj_id"] > 0) {
$ne->setValue(ilObject::_lookupTitle($trigger["obj_id"]));
} else {
$ne->setValue($lng->txt("skmg_no_trigger"));
}
$this->form->addItem($ne);
if ($trigger["obj_id"] > 0) {
$this->form->addCommandButton("removeLevelTrigger", $lng->txt("skmg_remove_trigger"));
}
$this->form->addCommandButton("selectLevelTrigger", $lng->txt("skmg_select_trigger"));
$this->form->setTitle($lng->txt("skmg_skill_level_trigger"));
$this->form->setFormAction($ilCtrl->getFormAction($this));
$tpl->setContent($this->form->getHTML());
}
示例11: getObjectTreeOperations
function getObjectTreeOperations($sid, $ref_id, $user_id)
{
$this->initAuth($sid);
$this->initIlias();
if (!$this->__checkSession($sid)) {
return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
}
global $rbacsystem, $rbacreview, $ilAccess;
if (!($tmp_obj =& ilObjectFactory::getInstanceByRefId($ref_id, false))) {
return $this->__raiseError('No valid ref id given. Please choose an existing reference id of an ILIAS object', 'Client');
}
if (!($tmp_user =& ilObjectFactory::getInstanceByObjId($user_id, false))) {
return $this->__raiseError('No valid user id given.', 'Client');
}
if (ilObject::_isInTrash($ref_id)) {
return $this->__raiseError("Parent with ID {$target_id} has been deleted.", 'CLIENT_TARGET_DELETED');
}
// check visible for all upper tree entries
if (!$ilAccess->checkAccessOfUser($tmp_user->getId(), 'visible', '', $tmp_obj->getRefId())) {
return array();
}
$op_data = $rbacreview->getOperation(2);
$ops_data[] = $op_data;
if (!$ilAccess->checkAccessOfUser($tmp_user->getId(), 'read', '', $tmp_obj->getRefId())) {
return $ops_data;
}
$ops_data = array();
$ops = $rbacreview->getOperationsOnTypeString($tmp_obj->getType());
foreach ($ops as $ops_id) {
$op_data = $rbacreview->getOperation($ops_id);
if ($rbacsystem->checkAccessOfUser($user_id, $op_data['operation'], $tmp_obj->getRefId())) {
$ops_data[$ops_id] = $op_data;
}
}
foreach ($ops_data as $data) {
$ret_data[] = $data;
}
return $ret_data ? $ret_data : array();
}
示例12: updateWebLink
/**
* update a weblink with id.
*
* @param string $session_id current session
* @param int $ref_id refid id of weblink in repository
* @param string $weblink_xml xml description
*
* @return boolean true, if update successful, false otherwise
*/
function updateWebLink($sid, $ref_id, $weblink_xml)
{
$this->initAuth($sid);
$this->initIlias();
if (!$this->__checkSession($sid)) {
return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
}
global $rbacsystem, $tree, $ilLog;
if (ilObject::_isInTrash($ref_id)) {
return $this->__raiseError('Cannot perform update since weblink has been deleted.', 'CLIENT_OBJECT_DELETED');
}
// get obj_id
if (!($obj_id = ilObject::_lookupObjectId($ref_id))) {
return $this->__raiseError('No weblink found for id: ' . $ref_id, 'CLIENT_OBJECT_NOT_FOUND');
}
// Check access
$permission_ok = false;
foreach ($ref_ids = ilObject::_getAllReferences($obj_id) as $ref_id) {
if ($rbacsystem->checkAccess('edit', $ref_id)) {
$permission_ok = true;
break;
}
}
if (!$permission_ok) {
return $this->__raiseError('No permission to edit the weblink with id: ' . $ref_id, 'Server');
}
$webl = ilObjectFactory::getInstanceByObjId($obj_id, false);
if (!is_object($webl) or $webl->getType() != "webr") {
return $this->__raiseError('Wrong obj id or type for weblink with id ' . $ref_id, 'Client');
}
try {
include_once './Modules/WebResource/classes/class.ilWebLinkXmlParser.php';
$parser = new ilWebLinkXmlParser($webl, $weblink_xml);
$parser->setMode(ilWebLinkXmlParser::MODE_UPDATE);
$parser->start();
} catch (ilSaxParserException $e) {
return $this->__raiseError($e->getMessage(), 'Client');
} catch (ilWebLinkXMLParserException $e) {
return $this->__raiseError($e->getMessage(), 'Client');
}
// Check if required
return true;
}
示例13: checkObjectAccess
/**
* check access for ref id: expected type, permission, return object instance if returnobject is true
*
* @param int $ref_id
* @param string or array $expected_type
* @param string $permission
* @param boolean $returnObject
* @return Object or type
*/
public function checkObjectAccess($ref_id, $expected_type, $permission, $returnObject = false)
{
global $rbacsystem;
if (!is_numeric($ref_id)) {
return $this->__raiseError('No valid id given.', 'Client');
}
if (!ilObject::_exists($ref_id, true)) {
return $this->__raiseError('No object for id.', 'CLIENT_OBJECT_NOT_FOUND');
}
if (ilObject::_isInTrash($ref_id)) {
return $this->__raiseError('Object is already trashed.', 'CLIENT_OBJECT_DELETED');
}
$type = ilObjectFactory::getTypeByRefId($ref_id);
if (is_array($expected_type) && !in_array($type, $expected_type) || !is_array($expected_type) && $type != $expected_type) {
return $this->__raiseError("Wrong type {$type} for id. Expected: " . (is_array($expected_type) ? join(",", $expected_type) : $expected_type), 'CLIENT_OBJECT_WRONG_TYPE');
}
if (!$rbacsystem->checkAccess($permission, $ref_id, $type)) {
return $this->__raiseError('Missing permission $permission for type $type.', 'CLIENT_OBJECT_WRONG_PERMISSION');
}
if ($returnObject) {
return ilObjectFactory::getInstanceByRefId($ref_id);
}
return $type;
}
示例14: editDetails
public function editDetails($a_show_confirm = false)
{
/**
* @var $ilToolbar ilToolbarGUI
*/
global $ilToolbar;
include_once './Services/Payment/classes/class.ilPaymentSettings.php';
/** @var $genSet ilPaymentSettings */
$genSet = ilPaymentSettings::_getInstance();
if (!(int) $_GET['pobject_id']) {
ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
return $this->showObjects();
}
$this->__initPaymentObject((int) $_GET['pobject_id']);
$this->ctrl->setParameter($this, 'pobject_id', (int) $_GET['pobject_id']);
$this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
/** @var $tmp_obj ilObject */
$tmp_obj = ilObjectFactory::getInstanceByRefId($this->pobject->getRefId(), false);
if (is_object($tmp_obj)) {
$trash = '';
if (ilObject::_isInTrash($this->pobject->getRefId())) {
$trash = ' (' . $this->lng->txt('object_deleted') . ')';
}
$tmp_object['title'] = $tmp_obj->getTitle() . '' . $trash;
$tmp_object['type'] = $tmp_obj->getType();
} else {
$tmp_object['title'] = $this->lng->txt('object_not_found');
$tmp_object['type'] = false;
}
if ($a_show_confirm) {
include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
$oConfirmationGUI = new ilConfirmationGUI();
// set confirm/cancel commands
$oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this, "performDelete"));
$oConfirmationGUI->setHeaderText($this->lng->txt("paya_sure_delete_object"));
$oConfirmationGUI->setCancel($this->lng->txt("cancel"), "editDetails");
$oConfirmationGUI->setConfirm($this->lng->txt("confirm"), "performDelete");
$oConfirmationGUI->addItem('', $tmp_object['title'], $tmp_object['title']);
$this->tpl->setVariable('CONFIRMATION', $oConfirmationGUI->getHTML());
return true;
}
$ilToolbar->addButton($this->lng->txt('paya_edit_details'), $this->ctrl->getLinkTarget($this, 'editDetails'));
$ilToolbar->addButton($this->lng->txt('paya_edit_prices'), $this->ctrl->getLinkTarget($this, 'editPrices'));
$ilToolbar->addButton($this->lng->txt('pay_edit_abstract'), $this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'edit'));
include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
$oForm = new ilPropertyFormGUI();
$oForm->setFormAction($this->ctrl->getFormAction($this, 'updateDetails'));
$oForm->setTitle($tmp_object['title']);
if ($tmp_object['type']) {
$oForm->setTitleIcon(ilUtil::getImagePath('icon_' . $tmp_object['type'] . '_b.png'));
}
// repository path
$oPathGUI = new ilNonEditableValueGUI($this->lng->txt('path'));
$oPathGUI->setValue($this->__getHTMLPath($this->pobject->getRefId()));
$oForm->addItem($oPathGUI);
switch ($tmp_object['type']) {
case 'exc':
$exc_subtype_option = array();
$check_subtypes = ilPaymentObject::_checkExcSubtype($this->pobject->getRefId());
if (!in_array('download', $check_subtypes) || $this->pobject->getSubtype() == 'download') {
$exc_subtype_option['download'] = $this->lng->txt('download');
}
if (!in_array('upload', $check_subtypes) || $this->pobject->getSubtype() == 'upload') {
$exc_subtype_option['upload'] = $this->lng->txt('upload');
}
$oExcSubtype = new ilSelectInputGUI($this->lng->txt('select_subtype'), 'exc_subtype');
$oExcSubtype->setOptions($exc_subtype_option);
$oExcSubtype->setValue($this->pobject->getSubtype());
$oForm->addItem($oExcSubtype);
break;
default:
break;
}
// number of purchasers
$oPurchasersGUI = new ilNonEditableValueGUI($this->lng->txt('paya_count_purchaser'));
$oPurchasersGUI->setValue(ilPaymentBookings::_getCountBookingsByObject((int) $_GET['pobject_id']));
$oForm->addItem($oPurchasersGUI);
// vendors
$oVendorsGUI = new ilSelectInputGUI($this->lng->txt('paya_vendor'), 'vendor');
$oVendorsGUI->setOptions($this->__getVendors());
$oVendorsGUI->setValue($this->pobject->getVendorId());
$oForm->addItem($oVendorsGUI);
// status
$oStatusGUI = new ilSelectInputGUI($this->lng->txt('status'), 'status');
$oStatusGUI->setOptions($this->__getStatus());
$oStatusGUI->setValue($this->pobject->getStatus());
$oForm->addItem($oStatusGUI);
// pay methods
$oPayMethodsGUI = new ilSelectInputGUI($this->lng->txt('paya_pay_method'), 'pay_method');
$PMoptions = ilPaymethods::getPayMethodsOptions('not_specified');
$oPayMethodsGUI->setOptions($PMoptions);
$oPayMethodsGUI->setValue($this->pobject->getPayMethod());
$oForm->addItem($oPayMethodsGUI);
// topics
/** @var $shopTopicsObj ilShopTopics */
$shopTopicsObj = ilShopTopics::_getInstance();
$shopTopicsObj->read();
if (is_array($topics = $shopTopicsObj->getTopics()) && count($topics)) {
$oTopicsGUI = new ilSelectInputGUI($this->lng->txt('topic'), 'topic_id');
include_once 'Services/Payment/classes/class.ilShopTopics.php';
//.........这里部分代码省略.........
示例15: downloadFolder
public function downloadFolder()
{
global $lng, $rbacsystem, $ilAccess;
include_once "./Services/Utilities/classes/class.ilUtil.php";
include_once 'Modules/File/classes/class.ilObjFile.php';
include_once 'Modules/File/classes/class.ilFileException.php';
if (!$ilAccess->checkAccess("read", "", $this->getRefId())) {
$this->ilErr->raiseError(get_class($this) . "::downloadFolder(): missing read permission!", $this->ilErr->WARNING);
}
if (ilObject::_isInTrash($this->getRefId())) {
$this->ilErr->raiseError(get_class($this) . "::downloadFolder(): object is trashed!", $this->ilErr->WARNING);
}
$zip = PATH_TO_ZIP;
$tmpdir = ilUtil::ilTempnam();
ilUtil::makeDir($tmpdir);
$basename = ilUtil::getAsciiFilename($this->getTitle());
$deliverFilename = $basename . ".zip";
$zipbasedir = $tmpdir . DIRECTORY_SEPARATOR . $basename;
$tmpzipfile = $tmpdir . DIRECTORY_SEPARATOR . $deliverFilename;
try {
ilObjFolder::recurseFolder($this->getRefId(), $this->getTitle(), $tmpdir);
ilUtil::zip($zipbasedir, $tmpzipfile);
rename($tmpzipfile, $zipfile = ilUtil::ilTempnam());
ilUtil::delDir($tmpdir);
ilUtil::deliverFile($zipfile, $deliverFilename, '', false, true);
} catch (ilFileException $e) {
ilUtil::sendInfo($e->getMessage(), true);
}
}