tiki  21.2
About: Tiki Wiki is a Groupware/CMS (Content Management System) solution that has features like Wikis, Forums, Blogs, Articles, Image Gallery, Map Server, Link Directory, Multilingual Support, Bug Tracker, RSS Feeds etc. Latest release 21 with Long Term Support (LTS).
  Fossies Dox: tiki-21.2.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

tracker_force_fill.php
Go to the documentation of this file.
1 <?php
2 // (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3 //
4 // All Rights Reserved. See copyright.txt for details and a complete list of authors.
5 // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6 // $Id$
7 if (strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) != false) {
8  header('location: index.php');
9  exit;
10 }
11 global $user;
12 if (empty($user) || empty($prefs['tracker_force_tracker_id']) || empty($prefs['tracker_force_mandatory_field']) || empty($prefs['tracker_force_tracker_fields'])) {
13  return;
14 }
15 $tracker_id = $prefs['tracker_force_tracker_id'];
17 
18 if (empty($tracker_definition)) {
20  tr('A tracker with id "%0" is required to be filled in, but it was deleted', $tracker_id)
21  . "<br/>"
22  . tr('Update the preference "<b>%0</b>" on admin panel', tra('Tracker ID of tracker required to be filled in'))
23  );
24  return;
25 }
26 
27 //user field info
31 //mandatory field info
32 $mandatory_field_permname = $prefs['tracker_force_mandatory_field'];
35 
36 $fields = array_map('trim', explode(',', $prefs['tracker_force_tracker_fields']));
39 
40 if ($item) {
41  //if the mandatory field is empty or if it's a checkbox and is set to 'n', force tracker input
42  if (empty($item[$mandatory_field_id]) || ($mandatory_field_info['type'] == 'c' && $item[$mandatory_field_id] == "n")) {
43  $action = "update";
44  } else {
45  return; //do nothing
46  }
47 } else {
48  $action = "new";
49 }
50 
51 $smarty->assign_by_ref("force_fill_action", $action);
52 $smarty->assign("force_fill_tracker", $tracker_id);
53 $smarty->assign("force_fill_user_field", $user_field_id);
54 $smarty->assign("force_fill_user_field_permname", $user_field_permname);
55 $smarty->assign("force_fill_mandatory_field", $mandatory_field_id);
56 $smarty->assign("force_fill_item", $item);
57 $smarty->assign("force_fill_fields", json_encode($fields, JSON_FORCE_OBJECT));
tra
tra($content, $lg='', $unused=false, $args=[])
Definition: tra.php:37
Tracker_Definition\get
static get($trackerId)
Definition: Definition.php:16
TikiLib\lib
static lib($name)
Definition: tikilib.php:53
$user
if(strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !=false) global $user
Definition: tracker_force_fill.php:7
$fields
$fields
Definition: tracker_force_fill.php:36
$action
$action
Definition: references.php:35
tr
tr($content)
Definition: tra.php:22
$tracker_definition
$tracker_definition
Definition: tracker_force_fill.php:16
php
$user_field_id
if(empty($tracker_definition)) $user_field_id
Definition: tracker_force_fill.php:28
Feedback\warning
static warning($feedback, $sendHeaders=false)
Definition: Feedback.php:115
$smarty
$smarty
Definition: include_connect.php:17
$_SERVER
$_SERVER
Definition: tiki-installer.php:705
$prefs
if(strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !==false) global $prefs
Definition: include_connect.php:9
$mandatory_field_id
$mandatory_field_id
Definition: tracker_force_fill.php:34
$tracker_id
if(empty($user)||empty($prefs['tracker_force_tracker_id'])||empty($prefs['tracker_force_mandatory_field'])||empty($prefs['tracker_force_tracker_fields'])) $tracker_id
Definition: tracker_force_fill.php:15
exit
exit
Definition: reindex_file.php:61
$mandatory_field_permname
$mandatory_field_permname
Definition: tracker_force_fill.php:32
$trackerlib
$trackerlib
Definition: tracker_force_fill.php:37
$user_field
$user_field
Definition: tracker_force_fill.php:29
$user_field_permname
$user_field_permname
Definition: tracker_force_fill.php:30
$mandatory_field_info
$mandatory_field_info
Definition: tracker_force_fill.php:33
$item
$item
Definition: tracker_force_fill.php:38
GuzzleHttp\json_encode
json_encode($value, $options=0, $depth=512)
Definition: functions.php:324