ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCopyWizardSettingsXMLParser Class Reference
+ Inheritance diagram for ilCopyWizardSettingsXMLParser:
+ Collaboration diagram for ilCopyWizardSettingsXMLParser:

Public Member Functions

 __construct (string $xml)
 
 setHandlers ($a_xml_parser)
 
 handlerBeginTag ($a_xml_parser, string $a_name, array $a_attribs)
 
 getOptions ()
 
 getSourceId ()
 
 getTargetId ()
 
 handlerEndTag ($a_xml_parser, string $a_name)
 
 handlerCharacterData ($a_xml_parser, string $a_data)
 
- Public Member Functions inherited from ilSaxParser
 __construct (?string $path_to_file='', ?bool $throw_exception=false)
 
 setXMLContent (string $a_xml_content)
 
 getXMLContent ()
 
 getInputType ()
 
 startParsing ()
 stores xml data in array More...
 
 createParser ()
 
 setHandlers ($a_xml_parser)
 
 parse ($a_xml_parser, $a_fp=null)
 

Static Private Member Functions

static getActionForString ($s)
 

Private Attributes

array $options = []
 
int $source_id = 0
 
int $target_id = 0
 

Additional Inherited Members

- Data Fields inherited from ilSaxParser
string $xml_file
 
bool $throw_exception = false
 
- Protected Member Functions inherited from ilSaxParser
 openXMLFile ()
 
 handleError (string $message)
 
 setThrowException (bool $throw_exception)
 
- Protected Attributes inherited from ilSaxParser
ilLanguage $lng = null
 

Detailed Description

Definition at line 12 of file class.ilCopyWizardSettingsXMLParser.php.

Constructor & Destructor Documentation

◆ __construct()

ilCopyWizardSettingsXMLParser::__construct ( string  $xml)

Definition at line 18 of file class.ilCopyWizardSettingsXMLParser.php.

References ILIAS\GlobalScreen\Provider\__construct(), and ilSaxParser\setXMLContent().

19  {
20  parent::__construct('', true);
21  $this->setXMLContent($xml);
22  }
$xml
Definition: metadata.php:351
__construct(Container $dic, ilPlugin $plugin)
setXMLContent(string $a_xml_content)
+ Here is the call graph for this function:

Member Function Documentation

◆ getActionForString()

static ilCopyWizardSettingsXMLParser::getActionForString (   $s)
staticprivate

Definition at line 114 of file class.ilCopyWizardSettingsXMLParser.php.

References ilCopyWizardOptions\COPY_WIZARD_COPY, ilCopyWizardOptions\COPY_WIZARD_LINK, and ilCopyWizardOptions\COPY_WIZARD_OMIT.

114  : int
115  {
116  if ($s === "COPY") {
118  }
119 
120  if ($s === "LINK") {
122  }
123 
125  }

◆ getOptions()

ilCopyWizardSettingsXMLParser::getOptions ( )

Definition at line 99 of file class.ilCopyWizardSettingsXMLParser.php.

References $options.

99  : array
100  {
101  return $this->options;
102  }

◆ getSourceId()

ilCopyWizardSettingsXMLParser::getSourceId ( )

Definition at line 104 of file class.ilCopyWizardSettingsXMLParser.php.

References $source_id.

104  : ?int
105  {
106  return $this->source_id;
107  }

◆ getTargetId()

ilCopyWizardSettingsXMLParser::getTargetId ( )

Definition at line 109 of file class.ilCopyWizardSettingsXMLParser.php.

References $target_id.

109  : ?int
110  {
111  return $this->target_id;
112  }

◆ handlerBeginTag()

ilCopyWizardSettingsXMLParser::handlerBeginTag (   $a_xml_parser,
string  $a_name,
array  $a_attribs 
)
Parameters
XMLParser | resource$a_xml_parser

Definition at line 38 of file class.ilCopyWizardSettingsXMLParser.php.

References $DIC, $id, $type, ilObject\_isInTrash(), ilCopyWizardOptions\COPY_WIZARD_COPY, ilCopyWizardOptions\COPY_WIZARD_LINK, ilObjectFactory\getTypeByRefId(), and ILIAS\Repository\int().

38  : void
39  {
40  global $DIC;
41 
42  $objDefinition = $DIC['objDefinition'];
43  $ilAccess = $DIC['ilAccess'];
44  $tree = $DIC['tree'];
45 
46  switch ($a_name) {
47  case 'Settings':
48  $this->options = array();
49  $this->source_id = (int) $a_attribs["source_id"];
50  if (ilObject::_isInTrash($this->source_id)) {
51  throw new ilSaxParserException("Source id " . $this->source_id . " is in trash");
52  }
53  $this->target_id = (int) $a_attribs["target_id"];
54  if (ilObject::_isInTrash($this->target_id)) {
55  throw new ilSaxParserException("target id" . $this->target_id . " is in trash");
56  }
57  break;
58  case 'Option':
59  $id = (int) $a_attribs["id"];
61  throw new ilSaxParserException("Id $id is in trash");
62  }
63  if (!$tree->isInTree($id)) {
64  throw new ilSaxParserException("Id $id does not exist");
65  }
66 
67  $action = self::getActionForString($a_attribs["action"]);
69 
70  switch ($action) {
72  $perm_copy = $ilAccess->checkAccess('copy', '', $id);
73  $copy = $objDefinition->allowCopy($type);
74 
75  if ($perm_copy && $copy) {
76  $this->options [$id] = array("type" => $action);
77  } elseif ($copy && !$perm_copy) {
78  throw new ilSaxParserException("Missing copy permission for object " . $id);
79  } elseif (!$copy) {
80  throw new ilSaxParserException("Copy for object " . $id . " of type " . $type . " is not supported");
81  }
82  break;
84  $perm_link = $ilAccess->checkAccess('write', '', $id);
85  $link = $objDefinition->allowLink($type);
86 
87  if ($perm_link && $link) {
88  $this->options [$id] = array("type" => $action);
89  } elseif ($link && !$perm_link) {
90  throw new ilSaxParserException("Missing write permission for object " . $id);
91  } elseif (!$link) {
92  throw new ilSaxParserException("Link for object " . $id . " of type " . $type . " is not supported");
93  }
94  break;
95  }
96  }
97  }
$type
SaxParserException thrown by ilSaxParser if property throwException is set.
static getTypeByRefId(int $ref_id, bool $stop_on_error=true)
get object type by reference id
global $DIC
Definition: feed.php:28
static _isInTrash(int $ref_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ handlerCharacterData()

ilCopyWizardSettingsXMLParser::handlerCharacterData (   $a_xml_parser,
string  $a_data 
)
Parameters
XMLParser | resource$a_xml_parser

Definition at line 137 of file class.ilCopyWizardSettingsXMLParser.php.

137  : void
138  {
139  }

◆ handlerEndTag()

ilCopyWizardSettingsXMLParser::handlerEndTag (   $a_xml_parser,
string  $a_name 
)
Parameters
XMLParser | resource$a_xml_parser

Definition at line 130 of file class.ilCopyWizardSettingsXMLParser.php.

130  : void
131  {
132  }

◆ setHandlers()

ilCopyWizardSettingsXMLParser::setHandlers (   $a_xml_parser)
Parameters
XMLParser | resource$a_xml_parser
Returns
void

Definition at line 28 of file class.ilCopyWizardSettingsXMLParser.php.

28  : void
29  {
30  xml_set_object($a_xml_parser, $this);
31  xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag');
32  xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData');
33  }

Field Documentation

◆ $options

array ilCopyWizardSettingsXMLParser::$options = []
private

Definition at line 14 of file class.ilCopyWizardSettingsXMLParser.php.

Referenced by getOptions().

◆ $source_id

int ilCopyWizardSettingsXMLParser::$source_id = 0
private

Definition at line 15 of file class.ilCopyWizardSettingsXMLParser.php.

Referenced by getSourceId().

◆ $target_id

int ilCopyWizardSettingsXMLParser::$target_id = 0
private

Definition at line 16 of file class.ilCopyWizardSettingsXMLParser.php.

Referenced by getTargetId().


The documentation for this class was generated from the following file: