Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
generic_isearch.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Searches of referenced documents
8  *
9  * @author Anakeen
10  * @version $Id: generic_isearch.php,v 1.13 2007/09/07 07:23:57 eric Exp $
11  * @package FDL
12  * @subpackage
13  */
14 /**
15  */
16 
17 include_once ("FDL/Class.DocSearch.php");
18 include_once ("FDL/freedom_util.php");
19 include_once ("GENERIC/generic_util.php");
20 
21 include_once ("FDL/Class.DocRel.php");
22 // -----------------------------------
24 {
25  // -----------------------------------
26  // Get all the params
27  $docid = GetHttpVars("id"); // id doc to search
28  $famid = GetHttpVars("famid", 0); // restriction of search
29  $viewone = GetHttpVars("viewone"); //
30  $generic = (GetHttpVars("generic") == "Y"); //
31  $dbaccess = $action->dbaccess;
32 
33  if (($famid !== 0) && (!is_numeric($famid))) {
34  $nfamid = getFamIdFromName($dbaccess, $famid);
35  if (!$nfamid) $action->addWarningMsg(sprintf("family %s not found", $famid));
36  else $famid = $nfamid;
37  }
38 
39  if ($docid == "") $action->exitError(_("related search aborted : no parameter found"));
40 
42 
43  $sdoc = createTmpDoc($dbaccess, 'SSEARCH'); //new Special Seraches
44  $sdoc->setValue("ba_title", sprintf(_("related documents of %s") , $doc->title));
45  $sdoc->setValue("se_phpfile", "fdlsearches.php");
46  $sdoc->setValue("se_phpfunc", "relateddoc");
47  $sdoc->setValue("se_phparg", "$docid,$famid");
48 
49  try {
50  if (($err = $sdoc->Add()) != '') {
51  $action->exitError($err);
52  }
53  if (($err = $sdoc->setControl(false)) != '') {
54  $sdoc->delete(true);
55  $action->exitError($err);
56  }
57  if ($action->user->id != 1) {
58  if (($err = $sdoc->addControl($action->user->id, 'execute')) != '') {
59  $sdoc->delete(true);
60  $action->exitError($err);
61  }
62  }
63  }
64  catch(\Exception $e) {
65  if ($sdoc->isAffected()) {
66  $sdoc->delete(true);
67  }
68  $action->exitError($e->getMessage());
69  }
70 
71  setHttpVar("dirid", $sdoc->id);
72  if ($generic) {
73  include_once ("GENERIC/generic_list.php");
74  generic_list($action);
75  // redirect($action,"GENERIC","GENERIC_LIST&dirid=".$sdoc->id."&famid=$famid&catg=0");
76 
77  } else {
78  include_once ("FREEDOM/freedom_view.php");
79  $action->parent->name = "FREEDOM";
80  $freedomApp = new Application($action->dbaccess);
81  $freedomApp->Set('FREEDOM', $action->parent);
82  $viewMode = $freedomApp->getParam('FREEDOM_VIEW');
83  setHttpVar("view", $viewMode);
84  setHttpVar("target", "gisearch");
85  freedom_view($action);
86  // redirect($action,"FREEDOM","FREEDOM_VIEW&viewone=$viewone&dirid=".$sdoc->id);
87 
88  }
89  //
90 
91 
92 }
addWarningMsg($msg)
global $action
generic_isearch(Action &$action)
$viewone
exitError($texterr, $exit=true, $code="")
$docid
Definition: cleanFamily.php:13
getFamIdFromName($dbaccess, $name)
new_Doc($dbaccess, $id= '', $latest=false)
generic_list(&$action)
freedom_view(&$action)
$dbaccess
Definition: checkVault.php:17
createTmpDoc($dbaccess, $fromid, $defaultvalue=true)
if($file) if($subject==""&&$file) if($subject=="") $err
← centre documentaire © anakeen