Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
freedom_addbookmark.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Add folder in user bookmarks
9  *
10  * @author Anakeen 2005
11  * @version $Id: freedom_addbookmark.php,v 1.3 2005/06/28 08:37:46 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage
15  */
16 /**
17  */
18 include_once ("FDL/Class.Doc.php");
19 /**
20  * Add folder bookmark
21  * @param Action &$action current action
22  * @global dirid Http var : folder identificator to add
23  */
25 {
26  $dirid = GetHttpVars("dirid");
27 
28  $dbaccess = $action->GetParam("FREEDOM_DB");
29  $attrid = "FREEDOM_UBOOK";
30 
31  $ubook = $action->GetParam($attrid);
32  if (strlen($ubook) > 2) $tubook = explode('][', substr($ubook, 1, -1));
33  else $tubook = array();
34  $err = "";
35  $tid = array();
36  foreach ($tubook as $k => $v) {
37  list($id, $label) = explode("|", $v);
38  $tid[$id] = $label;
39  }
40  // add new folder
41  $doc = new_Doc($dbaccess, $dirid);
42  if ($doc->isAlive()) {
43  $tid[$doc->initid] = $doc->title;
44  } else {
45  $err = sprintf(_("folder is not valid: bookmark unchanged"));
46  }
47  // recompose the paramters
48  $newbook = "";
49  foreach ($tid as $k => $v) {
50  $newbook.= "[$k|$v]";
51  }
52 
53  if ($err != "") {
55  } else {
56  AddWarningMsg(sprintf(_("folder %s as been added in your bookmark") , $doc->title));
57  $action->parent->param->Set($attrid, $newbook, PARAM_USER . $action->user->id, $action->parent->id);
58  }
59 }
60 ?>
← centre documentaire © anakeen - published under CC License - Dynacase