Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
CheckWid.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 
7 class CheckWid extends CheckData
8 {
9  protected $folderName;
10  /**
11  * @var Doc
12  */
13  protected $doc;
14  /**
15  * @param array $data
16  * @param Doc $doc
17  * @return CheckWid
18  */
19  function check(array $data, &$doc = null)
20  {
21 
22  $this->folderName = isset($data[1]) ? $data[1] : null;
23  $this->doc = $doc;
24  $this->checkWorkflow();
25  return $this;
26  }
27  /**
28  * check id it is a search
29  * @return void
30  */
31  protected function checkWorkflow()
32  {
33  if ($this->folderName) {
34  try {
35  $d = new_doc('', $this->folderName);
36  if (!$d->isAlive()) {
37  $this->addError(ErrorCode::getError('WID0001', $this->folderName, $this->doc->name));
38  } elseif (!is_a($d, "WDoc")) {
39  $this->addError(ErrorCode::getError('WID0002', $this->folderName, $this->doc->name));
40  }
41  }
42  catch(Exception $e) {
43  $this->addError(ErrorCode::getError('WID0003', $e->getMessage() , $this->doc->name));
44  }
45  }
46  }
47 }
static getError($code, $args=null)
Definition: ErrorCode.php:27
$d
Definition: dav.php:77
$folderName
Definition: CheckWid.php:9
addError($msg)
Definition: CheckData.php:29
check(array $data, &$doc=null)
Definition: CheckWid.php:19
checkWorkflow()
Definition: CheckWid.php:31
$data
← centre documentaire © anakeen