Core  3.2
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  * @package FDL
5 */
6 /**
7  * Add folder in user bookmarks
8  *
9  * @author Anakeen
10  * @version $Id: freedom_addbookmark.php,v 1.3 2005/06/28 08:37:46 eric Exp $
11  * @package FDL
12  * @subpackage
13  */
14 /**
15  */
16 include_once ("FDL/Class.Doc.php");
17 /**
18  * Add folder bookmark
19  * @param Action &$action current action
20  * @global dirid int Http var : folder identifier to add
21  */
23 {
24  $dirid = GetHttpVars("dirid");
25 
26  $dbaccess = $action->dbaccess;
27  $attrid = "FREEDOM_UBOOK";
28 
29  $ubook = $action->GetParam($attrid);
30  if (strlen($ubook) > 2) $tubook = explode('][', substr($ubook, 1, -1));
31  else $tubook = array();
32  $err = "";
33  $tid = array();
34  foreach ($tubook as $k => $v) {
35  list($id, $label) = explode("|", $v);
36  $tid[$id] = $label;
37  }
38  // add new folder
40  if ($doc->isAlive()) {
41  $tid[$doc->initid] = $doc->title;
42  } else {
43  $err = sprintf(_("folder is not valid: bookmark unchanged"));
44  }
45  // recompose the paramters
46  $newbook = "";
47  foreach ($tid as $k => $v) {
48  $newbook.= "[$k|$v]";
49  }
50 
51  if ($err != "") {
52  AddWarningMsg($err);
53  } else {
54  AddWarningMsg(sprintf(_("folder %s as been added in your bookmark") , $doc->title));
55  $action->parent->param->Set($attrid, $newbook, Param::PARAM_USER . $action->user->id, $action->parent->id);
56  }
57 }
global $action
Set($name, &$parent)
const PARAM_USER
Definition: Class.Param.php:34
freedom_addbookmark(Action &$action)
new_Doc($dbaccess, $id= '', $latest=false)
$dbaccess
Definition: checkVault.php:17
if($file) if($subject==""&&$file) if($subject=="") $err
← centre documentaire © anakeen