function getUserGroupsInfo($extra_conditions = "", $order = "name", $escape = true)
 {
     $result = array();
     $extra_cond = "type = 'user_groups'";
     $extra_cond .= $extra_conditions ? $extra_conditions : "";
     $pgs = self::findAll(array('conditions' => $extra_cond, 'order' => $order));
     foreach ($pgs as $pg) {
         $result[$pg->getId()] = array('id' => $pg->getId());
         if ($escape) {
             $result[$pg->getId()]['name'] = escape_character($pg->getName());
         } else {
             $result[$pg->getId()]['name'] = str_replace("'", "'", $pg->getName());
         }
     }
     return $result;
 }
 function save_instantiated_parameters($template, $parameters, $parameterValues)
 {
     $instantiation_id = config_option('last_template_instantiation_id') + 1;
     foreach ($parameters as $param) {
         /* @var $param TemplateParameter */
         $param_val = array_var($parameterValues, $param->getName(), '');
         $param_val = escape_character($param_val);
         DB::execute("INSERT INTO `" . TABLE_PREFIX . "template_instantiated_parameters` (`template_id`, `instantiation_id`, `parameter_name`, `value`) VALUES\r\n\t\t\t\t\t('" . $template->getId() . "', '{$instantiation_id}', '" . escape_character($param->getName()) . "', '{$param_val}') ON DUPLICATE KEY UPDATE template_id=template_id");
     }
     set_config_option('last_template_instantiation_id', $instantiation_id);
     return $instantiation_id;
 }
    }
    if (str_ends_with($listeners_str, ",")) {
        $listeners_str = substr($listeners_str, 0, -1);
    }
    $listeners_str .= "}";
    ?>

	member_selector['<?php 
    echo $genid;
    ?>
'].properties['<?php 
    echo $dimension_id;
    ?>
'] = {
		title: '<?php 
    echo escape_character($dimension_name);
    ?>
',
		dimensionId: <?php 
    echo $dimension_id;
    ?>
,
		objectTypeId: '<?php 
    echo $content_object_type_id;
    ?>
',
		required: <?php 
    echo $is_required ? '1' : '0';
    ?>
,
		reloadDimensions: <?php 
 /**
  * End task templates
  */
 function getArrayInfo($full = false)
 {
     if (config_option("wysiwyg_tasks")) {
         if ($this->getTypeContent() == "text") {
             $desc = nl2br(htmlspecialchars($this->getText()));
         } else {
             $desc = purify_html(nl2br($this->getText()));
         }
     } else {
         if ($this->getTypeContent() == "text") {
             $desc = htmlspecialchars($this->getText());
         } else {
             $desc = html_to_text(html_entity_decode(nl2br($this->getText()), null, "UTF-8"));
         }
     }
     $member_ids = ObjectMembers::instance()->getCachedObjectMembers($this->getId());
     $result = array('id' => $this->getId(), 't' => $this->getObjectName(), 'desc' => $desc, 'members' => $member_ids, 'c' => $this->getCreatedOn() instanceof DateTimeValue ? $this->getCreatedOn()->getTimestamp() : 0, 'cid' => $this->getCreatedById(), 'otype' => $this->getObjectSubtype(), 'pc' => $this->getPercentCompleted(), 'memPath' => str_replace('"', "'", escape_character(json_encode($this->getMembersIdsToDisplayPath()))));
     if ($full) {
         $result['description'] = $this->getText();
     }
     $result['mas'] = $this->getColumnValue('multi_assignment', 0);
     if ($this->isCompleted()) {
         $result['s'] = 1;
     }
     if ($this->getParentId() > 0) {
         $result['pid'] = $this->getParentId();
     }
     //if ($this->getPriority() != 200)
     $result['pr'] = $this->getPriority();
     if ($this->getMilestoneId() > 0) {
         $result['mid'] = $this->getMilestoneId();
     }
     if ($this->getAssignedToContactId() > 0) {
         $result['atid'] = $this->getAssignedToContactId();
     }
     $result['atName'] = $this->getAssignedToName();
     if ($this->getCompletedById() > 0) {
         $result['cbid'] = $this->getCompletedById();
         $result['con'] = $this->getCompletedOn()->getTimestamp();
     }
     if ($this->getDueDate() instanceof DateTimeValue) {
         $result['dd'] = $this->getDueDate()->getTimestamp() + logged_user()->getTimezone() * 3600;
         $result['udt'] = $this->getUseDueTime() ? 1 : 0;
     }
     if ($this->getStartDate() instanceof DateTimeValue) {
         $result['sd'] = $this->getStartDate()->getTimestamp() + logged_user()->getTimezone() * 3600;
         $result['ust'] = $this->getUseStartTime() ? 1 : 0;
     }
     $time_estimate = $this->getTimeEstimate();
     $result['te'] = $this->getTimeEstimate();
     if ($time_estimate > 0) {
         $result['et'] = DateTimeValue::FormatTimeDiff(new DateTimeValue(0), new DateTimeValue($time_estimate * 60), 'hm', 60);
     }
     $result['tz'] = logged_user()->getTimezone() * 3600;
     $ot = $this->getOpenTimeslots();
     if ($ot) {
         $users = array();
         $time = array();
         $paused = array();
         foreach ($ot as $t) {
             if (!$t instanceof Timeslot) {
                 continue;
             }
             $time[] = $t->getSeconds();
             $users[] = $t->getContactId();
             $paused[] = $t->isPaused() ? 1 : 0;
             if ($t->isPaused() && $t->getContactId() == logged_user()->getId()) {
                 $result['wpt'] = $t->getPausedOn()->getTimestamp();
             }
         }
         $result['wt'] = $time;
         $result['wid'] = $users;
         $result['wp'] = $paused;
     }
     if ($this->isRepetitive()) {
         $result['rep'] = 1;
     }
     return $result;
 }
    ?>
'] = '<?php 
    echo escape_character($dim['hint'], null, true);
    ?>
';
		<?php 
}
?>
		<?php 
foreach ($other_dimensions as $dim) {
    ?>
			og.dimension_hints['<?php 
    echo $dim['id'];
    ?>
'] = '<?php 
    echo escape_character($dim['hint'], null, true);
    ?>
';
		<?php 
}
?>

		og.order_dimensions();
		og.original_ordered_dimensions = og.ordered_dimensions;

		og.dragging_object_ids = {};
		
		$( "#sortable-modules" ).sortable({
			start: function(event, object) {
				og.dragging_object_ids[object.item[0].id] = true;
			},
Example #6
0
}
foreach ($companies as $company) {
    $companies_array[] = $company->getArrayInfo();
}
?>
<div id="calHiddenFields">
	<input type="hidden" id="hfCalUsers" value="<?php 
echo clean(str_replace('"', "'", escape_character(json_encode($users_array))));
?>
"/>
	<input type="hidden" id="hfCalCompanies" value="<?php 
echo clean(str_replace('"', "'", escape_character(json_encode($companies_array))));
?>
"/>
	<input type="hidden" id="hfCalUserPreferences" value="<?php 
echo clean(str_replace('"', "'", escape_character(json_encode($userPreferences))));
?>
"/>
        <input id="<?php 
echo $genid;
?>
type_related" type="hidden" name="type_related" value="only" />
</div>

<div class="calendar" style="padding:0px;height:100%;overflow:hidden;" id="cal_main_div" onmouseup="og.clearPaintedCells();">
<div id="calendarPanelTopToolbar" class="x-panel-tbar" style="width:100%;display:block;background-color:#F0F0F0;"></div>
<div id="calendarPanelSecondTopToolbar" class="x-panel-tbar" style="width:100%;padding-top:0;display:block;background-color:#F0F0F0;"></div>
<div id="<?php 
echo $genid . "view_calendar";
?>
">  
$genid = gen_id();
$comments_required = config_option('file_revision_comments_required');
$loc = user_config_option('localization');
if (strlen($loc) > 2) {
    $loc = substr($loc, 0, 2);
}
$fname = $file->getObjectName();
$extension = "html";
if (!$file->isNew()) {
    $dot_pos = strrpos($fname, '.');
    if ($dot_pos !== false) {
        $extension = substr($fname, $dot_pos + 1);
        $fname = substr($fname, 0, $dot_pos);
    }
}
$fname_s = escape_character($fname);
?>

<form class="internalForm" style="height:100%; overflow:hidden;" id="<?php 
echo $genid;
?>
form" action="<?php 
echo get_url('files', 'save_document');
?>
" method="post" enctype="multipart/form-data" onsubmit="return og.addDocumentSubmit('<?php 
echo $genid;
?>
');">
<input type="hidden" name="instanceName" value="<?php 
echo $genid;
?>
');
	<?php 
}
?>

	<?php 
foreach (array_var($contact_data, 'all_emails') as $email) {
    ?>
		og.addNewEmailInput('<?php 
    echo $genid . $id_prefix;
    ?>
_emails_container', 'contact', '<?php 
    echo $email->getEmailTypeId();
    ?>
', '<?php 
    echo escape_character($email->getEmailAddress());
    ?>
', '<?php 
    echo $email->getId();
    ?>
');
	<?php 
}
?>
	}

	
	for (var i=0; i<og.address_types.length; i++) {
		if (og.address_types[i].code == 'work') def_address_type = og.address_types[i].id;
	}
	for (var i=0; i<og.webpage_types.length; i++) {
 static function getArrayInfo($raw_data, $full = false)
 {
     $desc = "";
     if ($full) {
         if (config_option("wysiwyg_tasks")) {
             if ($raw_data['type_content'] == "text") {
                 $desc = nl2br(htmlspecialchars($raw_data['text']));
             } else {
                 $desc = purify_html(nl2br($raw_data['text']));
             }
         } else {
             if ($raw_data['type_content'] == "text") {
                 $desc = htmlspecialchars($raw_data['text']);
             } else {
                 $desc = html_to_text(html_entity_decode(nl2br($raw_data['text']), null, "UTF-8"));
             }
         }
     }
     $member_ids = ObjectMembers::instance()->getCachedObjectMembers($raw_data['id']);
     $tmp_task = new ProjectTask();
     $tmp_task->setObjectId($raw_data['id']);
     $tmp_task->setId($raw_data['id']);
     $tmp_task->setAssignedToContactId($raw_data['assigned_to_contact_id']);
     $result = array('id' => (int) $raw_data['id'], 'name' => $raw_data['name'], 'description' => $desc, 'members' => $member_ids, 'createdOn' => strtotime($raw_data['created_on']), 'createdById' => (int) $raw_data['created_by_id'], 'otype' => $raw_data['object_subtype'], 'percentCompleted' => (int) $raw_data['percent_completed'], 'memPath' => str_replace('"', "'", escape_character(json_encode($tmp_task->getMembersIdsToDisplayPath()))));
     if (isset($raw_data['isread'])) {
         $result['isread'] = $raw_data['isread'];
     }
     $result['multiAssignment'] = (int) array_var($raw_data, 'multi_assignment');
     if ($raw_data['completed_by_id'] > 0) {
         $result['status'] = 1;
     }
     if ($raw_data['parent_id'] > 0) {
         $result['parentId'] = (int) $raw_data['parent_id'];
     }
     $result['subtasksIds'] = $tmp_task->getSubTasksIds();
     //if ($this->getPriority() != 200)
     $result['priority'] = (int) $raw_data['priority'];
     if ($raw_data['milestone_id'] > 0) {
         $result['milestoneId'] = (int) $raw_data['milestone_id'];
     }
     if ($raw_data['assigned_by_id'] > 0) {
         $result['assignedById'] = (int) $raw_data['assigned_by_id'];
     }
     if ($raw_data['assigned_to_contact_id'] > 0) {
         $result['assignedToContactId'] = (int) $raw_data['assigned_to_contact_id'];
     }
     $result['atName'] = $tmp_task->getAssignedToName();
     if ($raw_data['completed_by_id'] > 0) {
         $result['completedById'] = (int) $raw_data['completed_by_id'];
         $result['completedOn'] = strtotime($raw_data['completed_on']);
     }
     if ($raw_data['due_date'] != EMPTY_DATETIME) {
         $result['useDueTime'] = $raw_data['use_due_time'] ? 1 : 0;
         if ($result['useDueTime']) {
             $result['dueDate'] = strtotime($raw_data['due_date']) + logged_user()->getTimezone() * 3600;
         } else {
             $result['dueDate'] = strtotime($raw_data['due_date']);
         }
     }
     if ($raw_data['start_date'] != EMPTY_DATETIME) {
         $result['useStartTime'] = $raw_data['use_start_time'] ? 1 : 0;
         if ($result['useStartTime']) {
             $result['startDate'] = strtotime($raw_data['start_date']) + logged_user()->getTimezone() * 3600;
         } else {
             $result['startDate'] = strtotime($raw_data['start_date']);
         }
     }
     $time_estimate = $raw_data['time_estimate'];
     $result['timeEstimate'] = $raw_data['time_estimate'];
     if ($time_estimate > 0) {
         $result['timeEstimateString'] = str_replace(',', ',<br>', DateTimeValue::FormatTimeDiff(new DateTimeValue(0), new DateTimeValue($time_estimate * 60), 'hm', 60));
     }
     $result['timeZone'] = logged_user()->getTimezone() * 3600;
     $ot = $tmp_task->getOpenTimeslots();
     if ($ot) {
         $users = array();
         $time = array();
         $paused = array();
         foreach ($ot as $t) {
             if (!$t instanceof Timeslot) {
                 continue;
             }
             $time[] = $t->getSeconds();
             $users[] = $t->getContactId();
             $paused[] = $t->isPaused() ? 1 : 0;
             if ($t->isPaused() && $t->getContactId() == logged_user()->getId()) {
                 $result['pauseTime'] = $t->getPausedOn()->getTimestamp();
             }
         }
         $result['workingOnTimes'] = $time;
         $result['workingOnIds'] = $users;
         $result['workingOnPauses'] = $paused;
     }
     $total_minutes = $tmp_task->getTotalMinutes();
     if ($total_minutes > 0) {
         $result['worked_time'] = $total_minutes;
         $result['worked_time_string'] = str_replace(',', ',<br>', DateTimeValue::FormatTimeDiff(new DateTimeValue(0), new DateTimeValue($total_minutes * 60), 'hm', 60));
     } else {
         $result['worked_time'] = 0;
     }
     $pending_time = $time_estimate - $total_minutes;
     if ($pending_time > 0) {
         $result['pending_time'] = $pending_time;
         $result['pending_time_string'] = str_replace(',', ',<br>', DateTimeValue::FormatTimeDiff(new DateTimeValue(0), new DateTimeValue($pending_time * 60), 'hm', 60));
     } else {
         $result['pending_time'] = 0;
     }
     if ($raw_data['repeat_forever'] > 0 || $raw_data['repeat_num'] > 0 || $raw_data['repeat_end'] != EMPTY_DATETIME && $raw_data['repeat_end'] != '') {
         $result['repetitive'] = 1;
     }
     $tmp_members = array();
     if (count($member_ids) > 0) {
         $tmp_members = Members::findAll(array("conditions" => "id IN (" . implode(',', $member_ids) . ")"));
     }
     $result['can_add_timeslots'] = can_add_timeslots(logged_user(), $tmp_members);
     //tasks dependencies
     if (config_option('use tasks dependencies')) {
         //get all dependant tasks ids, not completed yet
         $pending_tasks_ids = ProjectTaskDependencies::getDependenciesForTaskOnlyPendingIds($tmp_task->getId());
         //get the total of previous tasks
         $result['dependants'] = $pending_tasks_ids;
         $result['previous_tasks_total'] = ProjectTaskDependencies::countPendingPreviousTasks($tmp_task->getId());
     }
     return $result;
 }
			this.dialog.show();
		}
		
		<?php 
if (!$task->isCompleted()) {
    ?>
			og.changeTaskRepeat();
		<?php 
}
?>

		<?php 
if (!$task->isNew()) {
    $subtasks = ProjectTasks::findAll(array('conditions' => "parent_id=" . $task->getId() . " AND trashed_by_id=0"));
    foreach ($subtasks as $st) {
        $st_name = clean(escape_character($st->getObjectName()));
        ?>
					ogTasks.drawAddSubTaskInputs('<?php 
        echo $genid;
        ?>
', {id:'<?php 
        echo $st->getId();
        ?>
', name:'<?php 
        echo $st_name;
        ?>
', assigned_to:'<?php 
        echo $st->getAssignedToContactId();
        ?>
'});
		<?php 
Example #11
0
	    		}
	    		<?php 
    }
    ?>
	    		
	    		og.ogPermPrepareSendData('<?php 
    echo $genid;
    ?>
');
	    		$("#user_role_div").remove();

		    	<?php 
    if (count($all_user_groups) > 0) {
        ?>
		    		var groups_store_tmp = Ext.util.JSON.decode('<?php 
        echo escape_character(json_encode($all_user_groups));
        ?>
');
		    		var groups_store = [];
		    		for (x in groups_store_tmp) {
		    			groups_store.push([groups_store_tmp[x].id, groups_store_tmp[x].name]);
		    		}
		    		
		    		var groups_combo = new Ext.form.ComboBox({
		    			renderTo:'<?php 
        echo $genid;
        ?>
user_groups_selector_div',
		    			name: 'user_groups_selector',
		    			id: '<?php 
        echo $genid;
Example #12
0
function render_single_dimension_tree($dimension, $genid = null, $selected_members = array(), $options = array())
{
    if ($dimension instanceof Dimension) {
        $dimension_info = array('dimension_id' => $dimension->getId(), 'dimension_name' => $dimension->getName(), 'is_multiple' => $dimension->getAllowsMultipleSelection());
    } else {
        $dimension_info = $dimension;
    }
    $custom_name = DimensionOptions::getOptionValue($dimension_info['dimension_id'], 'custom_dimension_name');
    $dimension_info['dimension_name'] = $custom_name && trim($custom_name) != "" ? $custom_name : $dimension_info['dimension_name'];
    $dimension_id = $dimension_info['dimension_id'];
    if (is_null($genid)) {
        $genid = gen_id();
    }
    $selected_members_json = json_encode($selected_members);
    if (!isset($options['component_id'])) {
        $component_id = "{$genid}-member-chooser-panel-{$dimension_id}";
    } else {
        $component_id = $options['component_id'];
    }
    ?>
		 
		<?php 
    if (isset($options['use_ajax_member_tree']) && $options['use_ajax_member_tree']) {
        ?>
		<?php 
    } else {
        ?>
			<input id='<?php 
        echo $genid . array_var($options, 'pre_hf_id', '');
        ?>
members' name='<?php 
        echo array_var($options, 'pre_hf_id', '');
        ?>
members' type='hidden' ></input> 
		<?php 
    }
    ?>

		<div id='<?php 
    echo $component_id;
    ?>
-container' class="<?php 
    echo array_var($options, 'pre_class', '');
    ?>
single-tree member-chooser-container" ></div>
		
		<script>
			var memberChooserPanel = new og.MemberChooserPanel({
				renderTo: '<?php 
    echo $component_id;
    ?>
-container',
				id: '<?php 
    echo $component_id;
    ?>
',
				selectedMembers: <?php 
    echo $selected_members_json;
    ?>
,
				layout: 'column'
			}) ;
			
			<?php 
    if (is_array(array_var($options, 'allowedDimensions')) && array_search($dimension_id, $options['allowedDimensions']) === false) {
        continue;
    }
    $dimension_name = escape_character($dimension_info['dimension_name']);
    if (!isset($id)) {
        $id = gen_id();
    }
    ?>
			var select_root = <?php 
    echo array_var($options, 'select_root') ? '1' : '0';
    ?>
;
			var config = {
				id: '<?php 
    echo $component_id;
    ?>
-tree',
				genid: '<?php 
    echo $genid;
    ?>
',
				title: '<?php 
    echo $dimension_name;
    ?>
',
				dimensionId: <?php 
    echo $dimension_id;
    ?>
,
				search_placeholder: '<?php 
    echo array_var($options, 'search_placeholder', lang('search'));
    ?>
',
				filterContentType: '<?php 
    echo array_var($options, 'filterContentType', 1);
    ?>
',		
				collapsed: <?php 
    echo array_var($options, 'collapsed') ? 'true' : 'false';
    ?>
,
				collapsible: <?php 
    echo array_var($options, 'collapsible') ? 'true' : 'false';
    ?>
,
				all_members: <?php 
    echo array_var($options, 'all_members') ? 'true' : 'false';
    ?>
,
				objectTypeId: '<?php 
    echo array_var($options, 'object_type_id', 0);
    ?>
',
				isMultiple: '<?php 
    echo array_var($options, 'is_multiple', 0);
    ?>
',
				selModel: <?php 
    echo array_var($dimension_info, 'is_multiple') ? 'new Ext.tree.MultiSelectionModel()' : 'new Ext.tree.DefaultSelectionModel()';
    ?>
,
				height: <?php 
    echo array_var($options, 'height', '270');
    ?>
,
				width: <?php 
    echo array_var($options, 'width', '385');
    ?>
,
				listeners: {'tree rendered': function (t) {if (select_root) t.root.select();}}
			};
		
			<?php 
    if (isset($options['root_lang'])) {
        ?>
				config.root_lang = <?php 
        echo json_encode($options['root_lang']);
        ?>
;
			<?php 
    }
    ?>
			
			<?php 
    if (isset($options['allowedMemberTypes'])) {
        ?>
				config.allowedMemberTypes = <?php 
        echo json_encode($options['allowedMemberTypes']);
        ?>
;
			<?php 
    }
    ?>

			<?php 
    if (isset($options['checkBoxes']) && !$options['checkBoxes']) {
        ?>
				config.checkBoxes = false;
			<?php 
    }
    ?>

			<?php 
    if (isset($options['loadUrl'])) {
        ?>
				config.loadUrl = '<?php 
        echo $options['loadUrl'];
        ?>
';
			<?php 
    }
    ?>

			<?php 
    if (array_var($options, 'enableDD')) {
        ?>
				config.enableDD = true;
				config.dropConfig = {
					ddGroup: '<?php 
        echo array_var($options, 'ddGroup');
        ?>
',
					allowContainerDrop: true
				};
				config.dragConfig = {
					ddGroup: '<?php 
        echo array_var($options, 'ddGroup');
        ?>
',
					containerScroll: true
				};
			<?php 
    }
    ?>
			
			<?php 
    if (isset($options['loadUrl'])) {
        ?>
				config.loadUrl = '<?php 
        echo $options['loadUrl'];
        ?>
';
			<?php 
    }
    ?>

			<?php 
    if (isset($options['use_ajax_member_tree']) && $options['use_ajax_member_tree']) {
        ?>
				<?php 
        if (isset($options['select_function'])) {
            ?>
					config.selectFunction = '<?php 
            echo $options['select_function'];
            ?>
';
				<?php 
        } else {
            ?>
					config.selectFunction = '<?php 
            echo "";
            ?>
';
				<?php 
        }
        ?>
				var tree = new og.MemberTreeAjax ( config );
			<?php 
    } else {
        ?>
				var tree = new og.MemberChooserTree ( config );
			<?php 
    }
    ?>
			
			<?php 
    if (array_var($options, 'enableDD') && array_var($options, 'enddrag_function')) {
        ?>
				tree.on('enddrag', <?php 
        echo array_var($options, 'enddrag_function');
        ?>
);
			<?php 
    }
    ?>
			<?php 
    if (array_var($options, 'enableDD') && array_var($options, 'beforenodedrop_function')) {
        ?>
				tree.on('beforenodedrop', <?php 
        echo array_var($options, 'beforenodedrop_function');
        ?>
);
			<?php 
    }
    ?>
			<?php 
    if (array_var($options, 'enableDD') && array_var($options, 'startdrag_function')) {
        ?>
				tree.on('startdrag', <?php 
        echo array_var($options, 'startdrag_function');
        ?>
);
			<?php 
    }
    ?>
			
			memberChooserPanel.add(tree);
			og.can_submit_members = true;
			
			<?php 
    if (!isset($options['dont_load']) || !$options['dont_load']) {
        ?>
			memberChooserPanel.initialized = true;
			memberChooserPanel.doLayout();
			<?php 
    }
    ?>
		</script>
	
<?php 
}
?>
"/>
	<input type="hidden" id="hfUserPreferences" value="<?php 
echo clean(str_replace('"', "'", escape_character(json_encode($userPreferences))));
?>
"/>
	<input type="hidden" id="hfUserPermissions" value="<?php 
echo clean(str_replace('"', "'", escape_character(json_encode($userPermissions))));
?>
"/>
	<input type="hidden" id="hfObjectSubtypes" value="<?php 
echo clean(str_replace('"', "'", escape_character(json_encode($object_subtypes_array))));
?>
"/>
	<input type="hidden" id="hfDependencyCount" value="<?php 
echo clean(str_replace('"', "'", escape_character(json_encode($dependency_count))));
?>
"/>
	<input id="<?php 
echo $genid;
?>
type_related" type="hidden" name="type_related" value="only" />
	<input id="<?php 
echo $genid;
?>
complete_task" type="hidden" name="complete_task" value="yes" />        
</div>

<div id="tasksPanel" class="ogContentPanel" style="background-color:white;background-color:#F0F0F0;height:100%;width:100%;">
    
	<div id="tasksPanelTopToolbar" class="x-panel-tbar" style="width:100%;display:block;background-color:#F0F0F0;"></div>
 function format_value()
 {
     $formatted = "";
     $cp = MemberCustomProperties::getCustomProperty($this->getCustomPropertyId());
     if ($cp instanceof MemberCustomProperty) {
         switch ($cp->getType()) {
             case 'text':
             case 'numeric':
             case 'memo':
                 $formatted = $this->getValue();
                 break;
             case 'user':
             case 'contact':
                 $c = Contacts::findById($this->getValue());
                 $formatted = $c instanceof Contact ? clean($c->getObjectName()) : '';
                 break;
             case 'boolean':
                 $formatted = '<div class="db-ico ico-' . ($this->getValue() ? 'complete' : 'delete') . '">&nbsp;</div>';
                 break;
             case 'date':
                 if ($this->getValue() != '' && $this->getValue() != EMPTY_DATE && $this->getValue() != EMPTY_DATETIME) {
                     $dtv = DateTimeValueLib::dateFromFormatAndString(DATE_MYSQL, $this->getValue());
                     if ($dtv instanceof DateTimeValue) {
                         $formatted = format_date($dtv, null, 0);
                     }
                 }
                 break;
             case 'list':
                 $formatted = $this->getValue();
                 break;
             case 'table':
                 $formatted = $this->getValue();
                 break;
             case 'address':
                 $values = str_replace("\\|", "%%_PIPE_%%", $this->getValue());
                 $exploded = explode("|", $values);
                 foreach ($exploded as &$v) {
                     $v = str_replace("%%_PIPE_%%", "|", $v);
                     $v = escape_character($v);
                 }
                 if (count($exploded) > 0) {
                     $address_type = array_var($exploded, 0, '');
                     $street = array_var($exploded, 1, '');
                     $city = array_var($exploded, 2, '');
                     $state = array_var($exploded, 3, '');
                     $country = array_var($exploded, 4, '');
                     $zip_code = array_var($exploded, 5, '');
                     $out = $street;
                     if ($city != '') {
                         $out .= ' - ' . $city;
                     }
                     if ($state != '') {
                         $out .= ' - ' . $state;
                     }
                     if ($country != '') {
                         $out .= ' - ' . lang("country {$country}");
                     }
                     $formatted = '<div class="info-content-item">' . $out . '&nbsp;<a class="map-link coViewAction ico-map" href="http://maps.google.com/?q=' . $out . '" target="_blank">' . lang('map') . '</a></div>';
                 }
                 break;
             default:
                 $formatted = $this->getValue();
         }
     }
     return $formatted;
 }
Example #15
0
if (is_array($objects)) {
    foreach ($objects as $o) {
        ?>
			
			og.redrawTemplateObjectsLists(<?php 
        echo json_encode($o);
        ?>
);			
			<?php 
        if (isset($object_properties) && is_array($object_properties)) {
            $oid = $o["object_id"];
            if (isset($object_properties[$oid])) {
                foreach ($object_properties[$oid] as $objProp) {
                    $property = $objProp->getProperty();
                    $value = str_replace("\n", "\\n", $objProp->getValue());
                    $value = escape_character($value);
                    ?>
							og.addTemplateObjectProperty(<?php 
                    echo $oid;
                    ?>
, <?php 
                    echo $oid;
                    ?>
, '<?php 
                    echo $property;
                    ?>
', '<?php 
                    echo $value;
                    ?>
');
					  <?php 
 function system_modules()
 {
     if (!can_manage_configuration(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     ajx_set_no_toolbar();
     $modules = array();
     $other_modules = array();
     $disabled_modules = array();
     // mail
     $mail_info = null;
     if (!Plugins::instance()->isActivePlugin('mail')) {
         $mail_info = array('id' => 'mails-panel', 'name' => lang('email tab'), 'link' => 'http://www.fengoffice.com/web/email.php', 'ico' => 'ico-large-mail');
         $disabled_modules[] = $mail_info;
     }
     /*	$lo_info = array(
     				'id' => 'liquid-office',
     				'name' => lang('liquid office'),
     				'link' => 'https://www.liquid-office.eu/',
     				'ico' => 'ico-large-liquid-office',
     		);
     		$disabled_modules[] = $lo_info;*/
     $tab_panels = TabPanels::findAll(array('conditions' => "id<>'more-panel' AND (plugin_id is NULL OR plugin_id = 0 OR plugin_id IN (SELECT id FROM " . TABLE_PREFIX . "plugins WHERE is_installed > 0))", 'order' => 'ordering'));
     foreach ($tab_panels as $panel) {
         if ($panel->getId() == 'mails-panel' && $mail_info != null) {
             continue;
         }
         $enabled = $panel->getEnabled();
         if ($enabled && $panel->getPluginId() > 0) {
             $plugin = Plugins::findById($panel->getPluginId());
             $enabled = $enabled && $plugin instanceof Plugin && $plugin->isActive();
         }
         $modules[] = array('id' => $panel->getId(), 'name' => lang($panel->getTitle()), 'enabled' => $enabled, 'ico' => str_replace('ico-', 'ico-large-', $panel->getIconCls()), 'hint' => escape_character(lang('system module ' . $panel->getId() . ' hint')));
     }
     // gantt
     $gantt_plugin = Plugins::instance()->findOne(array('conditions' => "name='gantt'"));
     if ($gantt_plugin instanceof Plugin) {
         $gantt_info = array('id' => 'gantt', 'name' => lang('gantt chart'), 'enabled' => $gantt_plugin->isActive(), 'ico' => 'ico-large-gantt-module', 'hint' => escape_character(lang('system module gantt hint')));
         $other_modules[] = $gantt_info;
     }
     /*		
     		// member_custom_properties
     		$member_custom_properties_plugin = Plugins::instance()->findOne(array('conditions' => "name='member_custom_properties'"));
     		if ($member_custom_properties_plugin instanceof Plugin) {
     			$member_custom_properties_plugin = array(
     					'id' => 'member_custom_properties',
     					'name' => lang('member_custom_properties'),
     					'enabled' => $member_custom_properties_plugin->isActive(),
     					'ico' => 'ico-large-custom-properties',
     					'hint' => str_replace("'", "\'", ""),
     			);
     			$other_modules[] = $member_custom_properties_plugin;
     		}
     */
     /*		
     	// gantt
     	$gantt_info = array(
     			'id' => 'gantt',
     			'name' => lang('gantt chart'),
     			'ico' => 'ico-large-gantt-module',
     			'hint' => str_replace("'", "\'", lang('system module gantt hint')),
     	);
     	if (!Plugins::instance()->isActivePlugin('gantt')) {
     		if (Plugins::instance()->isActivePlugin('crpm')) {
     			$disabled_modules[] = $gantt_info;
     		}
     	} else {
     		$other_modules[] = $gantt_info;
     	}
     	
     	// expenses
     	$expenses_info = array(
     			'id' => 'expenses',
     			'name' => lang('expenses'),
     			'ico' => 'ico-large-expenses-module',
     			'hint' => str_replace("'", "\'", lang('system module expenses-panel hint')),
     	);
     	if (!Plugins::instance()->isActivePlugin('expenses')) {
     		if (Plugins::instance()->isActivePlugin('crpm')) {
     			$disabled_modules[] = $expenses_info;
     		}
     	}
     	// objectives
     	$expenses_info = array(
     			'id' => 'objectives',
     			'name' => lang('objectives'),
     			'ico' => 'ico-large-objectives-module',
     			'hint' => str_replace("'", "\'", lang('system module objectives-panel hint')),
     	);
     	if (!Plugins::instance()->isActivePlugin('objectives')) {
     		if (Plugins::instance()->isActivePlugin('crpm')) {
     			$disabled_modules[] = $expenses_info;
     		}
     	}
     */
     $active_dimensions_tmp = Dimensions::findAll(array('order' => 'default_order'));
     $active_dimensions = array();
     foreach ($active_dimensions_tmp as $dim) {
         if ($dim->getCode() == 'feng_persons') {
             continue;
         }
         $dname = $dim->getName();
         $active_dimensions[$dim->getCode()] = array('id' => $dim->getId(), 'name' => $dname, 'code' => $dim->getCode(), 'ico' => 'ico-large-' . $dim->getCode(), 'hint' => lang('system dimension ' . $dim->getCode() . ' hint'));
     }
     $dimensions_set = array_keys($active_dimensions);
     $other_dimensions = array();
     if (!isset($active_dimensions['workspaces'])) {
         $other_dimensions[] = array('name' => lang('workspaces'), 'ico' => 'ico-large-workspaces', 'hint' => lang('system dimension workspaces hint'));
     }
     if (!isset($active_dimensions['tags'])) {
         $other_dimensions[] = array('name' => lang('tags'), 'ico' => 'ico-large-tags', 'hint' => lang('system dimension tags hint'));
     }
     if (!isset($active_dimensions['customer_project'])) {
         if (Plugins::instance()->isActivePlugin('crpm')) {
             $other_dimensions[] = array('name' => lang('customer_project'), 'ico' => 'ico-large-customer_project', 'hint' => lang('system dimension customer_project hint'));
         }
     }
     $user_dimension_ids = config_option('enabled_dimensions');
     tpl_assign("modules", $modules);
     tpl_assign("other_modules", $other_modules);
     tpl_assign("disabled_modules", $disabled_modules);
     tpl_assign('active_dimensions', $active_dimensions);
     tpl_assign('other_dimensions', $other_dimensions);
     tpl_assign('user_dimension_ids', $user_dimension_ids);
 }
     echo $html;
     break;
 case 'address':
     $html = '<div id="' . $genid . 'addresscontainer-cp' . $customProp->getId() . '" class="address-input-container custom-property"></div>';
     $html .= "<div style='display:none;'>" . select_country_widget('template_country', '', array('id' => 'template_select_country')) . "</div>";
     $html .= "<script>\$(function(){";
     $all_address_types = AddressTypes::getAllAddressTypesInfo();
     $html .= "og.address_types = Ext.util.JSON.decode('" . json_encode($all_address_types) . "');";
     $values = CustomPropertyValues::getCustomPropertyValues($_custom_properties_object->getId(), $customProp->getId());
     if (is_array($values) && count($values) > 0) {
         foreach ($values as $val) {
             $values = str_replace("\\|", "%%_PIPE_%%", $val->getValue());
             $exploded = explode("|", $values);
             foreach ($exploded as &$v) {
                 $v = str_replace("%%_PIPE_%%", "|", $v);
                 $v = escape_character($v);
             }
             if (count($exploded) > 0) {
                 $address_type = array_var($exploded, 0, '');
                 $street = array_var($exploded, 1, '');
                 $city = array_var($exploded, 2, '');
                 $state = array_var($exploded, 3, '');
                 $country = array_var($exploded, 4, '');
                 $zip_code = array_var($exploded, 5, '');
                 $sel_data_str = "{street:'{$street}', city:'{$city}', state:'{$state}', zip_code:'{$zip_code}', country:'{$country}'}";
                 $html .= "og.renderAddressInput('cp" . $customProp->getId() . "', '{$name}', '" . $genid . "addresscontainer-cp" . $customProp->getId() . "', '{$address_type}', {$sel_data_str});";
             } else {
                 $html .= "og.renderAddressInput('cp" . $customProp->getId() . "', '{$name}', '" . $genid . "addresscontainer-cp" . $customProp->getId() . "', '', {});";
             }
         }
     } else {
 static function getArrayInfo($raw_data, $full = false)
 {
     $desc = "";
     if ($full) {
         if (config_option("wysiwyg_tasks")) {
             if ($raw_data['type_content'] == "text") {
                 $desc = nl2br(htmlspecialchars($raw_data['text']));
             } else {
                 $desc = purify_html(nl2br($raw_data['text']));
             }
         } else {
             if ($raw_data['type_content'] == "text") {
                 $desc = htmlspecialchars($raw_data['text']);
             } else {
                 $desc = html_to_text(html_entity_decode(nl2br($raw_data['text']), null, "UTF-8"));
             }
         }
     }
     $member_ids = ObjectMembers::instance()->getCachedObjectMembers($raw_data['id']);
     $tmp_task = new TemplateTask();
     $tmp_task->setObjectId($raw_data['id']);
     $tmp_task->setId($raw_data['id']);
     $tmp_task->setAssignedToContactId($raw_data['assigned_to_contact_id']);
     $result = array('id' => $raw_data['id'], 't' => $raw_data['name'], 'desc' => $desc, 'members' => $member_ids, 'c' => strtotime($raw_data['created_on']), 'cid' => (int) $raw_data['created_by_id'], 'otype' => $raw_data['object_subtype'], 'pc' => (int) $raw_data['percent_completed'], 'memPath' => str_replace('"', "'", escape_character(json_encode($tmp_task->getMembersIdsToDisplayPath()))));
     $result['mas'] = (int) array_var($raw_data, 'multi_assignment');
     if ($raw_data['completed_by_id'] > 0) {
         $result['s'] = 1;
     }
     if ($raw_data['parent_id'] > 0) {
         $result['pid'] = (int) $raw_data['parent_id'];
     }
     //if ($this->getPriority() != 200)
     $result['pr'] = (int) $raw_data['priority'];
     if ($raw_data['milestone_id'] > 0) {
         $result['mid'] = (int) $raw_data['milestone_id'];
     }
     if ($raw_data['assigned_to_contact_id'] > 0) {
         $result['atid'] = (int) $raw_data['assigned_to_contact_id'];
     }
     $result['atName'] = $tmp_task->getAssignedToName();
     if ($raw_data['completed_by_id'] > 0) {
         $result['cbid'] = (int) $raw_data['completed_by_id'];
         $result['con'] = strtotime($raw_data['completed_on']);
     }
     if ($raw_data['due_date'] != EMPTY_DATETIME) {
         $result['dd'] = strtotime($raw_data['due_date']) + logged_user()->getTimezone() * 3600;
         $result['udt'] = $raw_data['use_due_time'] ? 1 : 0;
     }
     if ($raw_data['start_date'] != EMPTY_DATETIME) {
         $result['sd'] = strtotime($raw_data['start_date']) + logged_user()->getTimezone() * 3600;
         $result['ust'] = $raw_data['use_start_time'] ? 1 : 0;
     }
     $time_estimate = $raw_data['time_estimate'];
     $result['te'] = $raw_data['time_estimate'];
     if ($time_estimate > 0) {
         $result['et'] = DateTimeValue::FormatTimeDiff(new DateTimeValue(0), new DateTimeValue($time_estimate * 60), 'hm', 60);
     }
     $result['tz'] = logged_user()->getTimezone() * 3600;
     $ot = $tmp_task->getOpenTimeslots();
     if ($ot) {
         $users = array();
         $time = array();
         $paused = array();
         foreach ($ot as $t) {
             if (!$t instanceof Timeslot) {
                 continue;
             }
             $time[] = $t->getSeconds();
             $users[] = $t->getContactId();
             $paused[] = $t->isPaused() ? 1 : 0;
             if ($t->isPaused() && $t->getContactId() == logged_user()->getId()) {
                 $result['wpt'] = $t->getPausedOn()->getTimestamp();
             }
         }
         $result['wt'] = $time;
         $result['wid'] = $users;
         $result['wp'] = $paused;
     }
     if ($raw_data['repeat_forever'] > 0 || $raw_data['repeat_num'] > 0 || $raw_data['repeat_end'] != EMPTY_DATETIME) {
         $result['rep'] = 1;
     }
     return $result;
 }
	<td rowspan=2 colspan="2" class="coViewHeader" style="width:auto;">
		<div id="iconDiv" class="coViewIconImage ico-large-report" style="float:left;"></div>

		<div class="coViewTitleContainer">
			<div class="coViewTitle" style="margin-left:55px;"><?php 
echo $title;
?>
</div>
			<input type="submit" name="print" value="<?php 
echo lang('print view');
?>
" onclick="og.reports.printReport('<?php 
echo $genid;
?>
','<?php 
echo escape_character($title);
?>
'); return false;" style="width:150px; margin-top:10px;"/>

			<input type="submit" name="exportCSV" value="<?php 
echo lang('export csv');
?>
" onclick="og.submit_csv_form('<?php 
echo $genid;
?>
');return false;" style="width:150px; margin-top:10px;"/>
			
		<?php 
if ($allow_export) {
    ?>
			<input type="button" name="exportPDFOptions" onclick="og.showPDFOptions();" value="<?php 
 function get_parent_permissions()
 {
     ajx_current("empty");
     $dim_id = array_var($_REQUEST, 'dim_id');
     $parent = array_var($_REQUEST, 'parent');
     $permission_parameters = array();
     $permission_parameters = get_default_member_permission($parent, $permission_parameters);
     $pg_data = array();
     $perms = array();
     foreach ($permission_parameters['member_permissions'] as $pg_id => $p) {
         if (is_array($p) && count($p) > 0) {
             $perms[$pg_id] = $p;
             // type picture_url name is_guest company_name role
             $pg = PermissionGroups::findById($pg_id);
             if ($pg->getType() == 'permission_groups') {
                 $c = Contacts::findById($pg->getContactId());
                 $name = $name = escape_character($c->getObjectName());
                 $picture_url = $c->getPictureUrl();
                 $company_name = $c->getCompany() instanceof Contact ? escape_character($c->getCompany()->getObjectName()) : "";
                 $type = 'contact';
                 $is_guest = $c->isGuest() ? "1" : "0";
                 $role = $c->getUserTypeName();
             } else {
                 $name = escape_character($pg->getName());
                 $picture_url = "";
                 $company_name = "";
                 $type = 'group';
                 $is_guest = "0";
                 $role = "";
             }
             $pg_data[$pg_id] = array('pg_id' => $pg_id, 'type' => $type, 'picture_url' => $picture_url, 'name' => $name, 'is_guest' => $is_guest, 'company_name' => $company_name, 'role' => $role);
         }
     }
     ajx_extra_data(array('perms' => $perms, 'pg_data' => $pg_data));
 }
		<?php 
    }
    ?>
	
		<?php 
    foreach ($company_data['all_addresses'] as $address) {
        ?>
			og.addNewAddressInput('<?php 
        echo $genid;
        ?>
_addresses_container', 'company', '<?php 
        echo $address->getAddressTypeId();
        ?>
', {
				street: '<?php 
        echo escape_character(str_replace("\n", " ", $address->getStreet()));
        ?>
',
				city: '<?php 
        echo str_replace("'", "\\'", $address->getCity());
        ?>
',
				state: '<?php 
        echo str_replace("'", "\\'", $address->getState());
        ?>
',
				zip_code: '<?php 
        echo str_replace("'", "\\'", $address->getZipCode());
        ?>
',
				country: '<?php 
Example #22
0
function get_custom_property_value_for_listing($cp, $obj)
{
    $cp_vals = CustomPropertyValues::getCustomPropertyValues($obj->getId(), $cp->getId());
    $val_to_show = "";
    foreach ($cp_vals as $cp_val) {
        if (in_array($cp->getType(), array('contact', 'user')) && $cp_val instanceof CustomPropertyValue) {
            $cp_contact = Contacts::findById($cp_val->getValue());
            if ($cp_contact instanceof Contact) {
                $cp_val->setValue($cp_contact->getObjectName());
            } else {
                $cp_val->setValue("");
            }
        }
        if ($cp->getType() == 'date' && $cp_val instanceof CustomPropertyValue) {
            $format = user_config_option('date_format');
            Hook::fire("custom_property_date_format", null, $format);
            $tmp_date = DateTimeValueLib::dateFromFormatAndString(DATE_MYSQL, $cp_val->getValue());
            if (str_starts_with($cp_val->getValue(), EMPTY_DATE)) {
                $formatted = "";
            } else {
                if (str_ends_with($cp_val->getValue(), "00:00:00")) {
                    $formatted = $tmp_date->format(user_config_option('date_format'));
                } else {
                    $formatted = $tmp_date->format($format);
                }
            }
            $cp_val->setValue($formatted);
        }
        if ($cp->getType() == 'address' && $cp_val instanceof CustomPropertyValue) {
            $values = str_replace("\\|", "%%_PIPE_%%", $cp_val->getValue());
            $exploded = explode("|", $values);
            foreach ($exploded as &$v) {
                $v = str_replace("%%_PIPE_%%", "|", $v);
                $v = escape_character($v);
            }
            if (count($exploded) > 0) {
                $address_type = array_var($exploded, 0, '');
                $street = array_var($exploded, 1, '');
                $city = array_var($exploded, 2, '');
                $state = array_var($exploded, 3, '');
                $country = array_var($exploded, 4, '');
                $zip_code = array_var($exploded, 5, '');
                $country_name = CountryCodes::getCountryNameByCode($country);
                $tmp = array();
                if ($street != '') {
                    $tmp[] = $street;
                }
                if ($city != '') {
                    $tmp[] = $city;
                }
                if ($state != '') {
                    $tmp[] = $state;
                }
                if ($zip_code != '') {
                    $tmp[] = $zip_code;
                }
                if ($country_name != '') {
                    $tmp[] = $country_name;
                }
                $cp_val->setValue(implode(' - ', $tmp));
            }
        }
        $val_to_show .= ($val_to_show == "" ? "" : ", ") . ($cp_val instanceof CustomPropertyValue ? $cp_val->getValue() : "");
    }
    return $val_to_show;
}
Example #23
0
    $allUsers_array[$usr->getId()] = $usr_info;
}
?>
og.allUsers =  <?php 
echo clean(str_replace('"', "'", escape_character(json_encode($allUsers_array))));
?>
;

<?php 
$object_types = ObjectTypes::getAllObjectTypes();
foreach ($object_types as $ot) {
    $types[$ot->getId()] = array("name" => $ot->getName(), "icon" => $ot->getIconClass(), "type" => $ot->getType());
}
?>
og.objectTypes =  <?php 
echo clean(str_replace('"', "'", escape_character(json_encode($types))));
?>
;

<?php 
$listing_preferences = ContactConfigOptions::getOptionsByCategoryName('listing preferences');
foreach ($listing_preferences as $lp) {
    if (str_starts_with($lp->getName(), 'lp_dim_')) {
        $dcode = str_replace('lp_dim_', '', str_replace('_show_as_column', '', $lp->getName()));
        $dim = Dimensions::findByCode($dcode);
        ?>
og.preferences['listing_preferences']['<?php 
        echo 'lp_dim_' . $dim->getId() . '_show_as_column';
        ?>
'] = <?php 
        echo user_config_option($lp->getName()) ? '1' : '0';