当前位置: 首页>>代码示例>>PHP>>正文


PHP active_context_members函数代码示例

本文整理汇总了PHP中active_context_members函数的典型用法代码示例。如果您正苦于以下问题:PHP active_context_members函数的具体用法?PHP active_context_members怎么用?PHP active_context_members使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了active_context_members函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: findAllowed

 static function findAllowed()
 {
     $ctxMembers = active_context_members();
     $permissionGroups = ContactPermissionGroups::getPermissionGroupIdsByContactCSV(logged_user()->getId());
     // Find members where user can add tasks
     $sql = "\r\n\t\t\tSELECT distinct(member_id) \r\n\t\t\tFROM " . TABLE_PREFIX . "contact_member_permissions o \r\n\t\t\tWHERE object_type_id = " . ProjectTasks::instance()->getObjectTypeId() . " \r\n\t\t\tAND permission_group_id IN ( {$permissionGroups} ) AND can_write= 1 \r\n\t\t\t\r\n\t\t\tUNION (\r\n\t\t\t\tSELECT DISTINCT id from " . TABLE_PREFIX . "members m WHERE m.dimension_id IN\r\n\t\t\t\t(\r\n\t\t\t\t\tSELECT DISTINCT dimension_id FROM " . TABLE_PREFIX . "contact_dimension_permissions WHERE permission_group_id IN ({$permissionGroups}) AND permission_type ='allow all'\r\n\t\t\t\t)\t\r\n\t\t\t)";
     $res = DB::execute($sql);
     $members = array();
     while ($row = $res->fetchRow()) {
         $members[] = $row['member_id'];
     }
     if (!count($members)) {
         return;
     }
     // Find templates that belongs to any $member
     $sql = "\r\n\t\t\tSELECT distinct(id) AS id\r\n\t\t\tFROM " . TABLE_PREFIX . "object_members om\r\n\t\t\tINNER JOIN " . TABLE_PREFIX . "templates t ON t.object_id = om.object_id\r\n\t\t\tINNER JOIN " . TABLE_PREFIX . "objects o ON om.object_id = o.id\r\n\t\t\tWHERE\r\n\t\t\t    member_id IN (" . implode(',', $members) . ")\r\n\t\t\tAND is_optimization = 0\r\n\t\t\tGROUP BY om.object_id\t\t\r\n\t\t";
     $res = DB::execute($sql);
     $tpls = array();
     // Iterate on the results and make som filtering
     while ($row = $res->fetchRow()) {
         $tpl = COTemplates::instance()->findById($row['id']);
         $templateMembers = $tpl->getMemberIds();
         if (!count(array_intersect($templateMembers, $ctxMembers))) {
             //array_intersect($templateMembers, $ctxMembers)
             continue;
         }
         // Chcheck if all template members are included in $mebers
         // TODO: PERFORMENCE This should be done in one sql instead of filtering here
         if (!count(array_diff($templateMembers, $members))) {
             $tpls[] = $tpl;
         } else {
         }
     }
     return $tpls;
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:35,代码来源:COTemplates.class.php

示例2: list_all

 function list_all()
 {
     ajx_current("empty");
     // Get all variables from request
     $start = array_var($_GET, 'start', 0);
     $limit = array_var($_GET, 'limit', config_option('files_per_page'));
     $order = 'name';
     $order_dir = array_var($_GET, 'dir');
     $action = array_var($_GET, 'action');
     $attributes = array("ids" => explode(',', array_var($_GET, 'ids')));
     if (!$order_dir) {
         switch ($order) {
             case 'name':
                 $order_dir = 'ASC';
                 break;
             default:
                 $order_dir = 'DESC';
         }
     }
     $dim_controller = new DimensionController();
     $members = $dim_controller->initial_list_dimension_members(Dimensions::findByCode('workspaces')->getId(), ObjectTypes::findByName('workspace')->getId(), $context, true);
     $ids = array();
     foreach ($members as $m) {
         $ids[] = $m['object_id'];
     }
     $members = active_context_members(false);
     // Context Members Ids
     $members_sql = "";
     if (count($members) > 0) {
         $members_sql .= " AND parent_member_id IN (" . implode(',', $members) . ")";
     } else {
         $members_sql .= " AND parent_member_id = 0";
     }
     $res = Members::findAll(array("conditions" => "object_id IN (" . implode(',', $ids) . ") " . $members_sql, 'offset' => $start, 'limit' => $limit, 'order' => "{$order} {$order_dir}"));
     $object = $this->prepareObject($res, $start, $limit, count($res));
     ajx_extra_data($object);
     tpl_assign("listing", $object);
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:38,代码来源:MemberController.class.php

示例3: add_mail


//.........这里部分代码省略.........
                 $body = preg_replace("/<body*[^>]*>/i", '<body>', $body);
                 // commented because sometimes brokes the html and leaves the body in blank
                 //$body = convert_to_links(preg_replace("/<body*[^>]*>/i",'<body>', $body));
                 $mail->setBodyHtml($body);
                 $mail->setBodyPlain(utf8_safe(html_to_text($body)));
             } else {
                 $mail->setBodyPlain($body);
                 $mail->setBodyHtml('');
             }
             $mail->setFrom($account->getEmailAddress());
             if ($accountUser->getIsDefault() && $accountUser->getSenderName() == "") {
                 $mail->setFromName(logged_user()->getObjectName());
             } else {
                 $mail->setFromName($accountUser->getSenderName());
             }
             $mail->save();
             //$mail->setIsRead(logged_user()->getId(), true);
             if (Plugins::instance()->isActivePlugin('mail_rules')) {
                 if (array_var($mail_data, 'format') == 'html') {
                     $img = MailTracks::get_track_mark_img($mail->getId());
                     $body = $body . $img;
                     $mail->setBodyHtml($body);
                     $mail->setBodyPlain(utf8_safe(html_to_text($body)));
                     $mail->save();
                 }
             }
             foreach ($project_files_attachments as $pfatt) {
                 if ($pfatt instanceof ProjectFile) {
                     $pfatt->setMailId($mail->getId());
                     $pfatt->save();
                     $pfatt->addToSharingTable();
                 }
             }
             $member_ids = active_context_members(false);
             // if replying a classified email classify on same workspace
             $classified_with_conversation = false;
             if (array_var($mail_data, 'original_id')) {
                 $in_reply_to = MailContents::findById(array_var($mail_data, 'original_id'));
                 if ($in_reply_to instanceof MailContent) {
                     $member_ids = array_merge($member_ids, $in_reply_to->getMemberIds());
                     $classified_with_conversation = true;
                 }
             }
             // autoclassify sent email if not classified
             if (!$classified_with_conversation) {
                 $acc_mem_ids = explode(',', $account->getMemberId());
                 foreach ($acc_mem_ids as $acc_mem_id) {
                     $member_ids[] = $acc_mem_id;
                 }
             }
             $object_controller = new ObjectController();
             foreach ($member_ids as $k => &$mem_id) {
                 if ($mem_id == "") {
                     unset($member_ids[$k]);
                 }
             }
             if (count($member_ids) > 0) {
                 //$object_controller->add_to_members($mail, $member_ids);
                 $members = Members::instance()->findAll(array('conditions' => 'id IN (' . implode(',', $member_ids) . ')'));
                 $mail->addToMembers($members, true);
                 $mail->addToSharingTable();
             }
             $object_controller->link_to_new_object($mail);
             $object_controller->add_subscribers($mail);
             /*
             				if (array_var($mail_data, 'link_to_objects') != ''){
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:67,代码来源:MailController.class.php

示例4: active_context

$currentday = $today->format("j");
$currentmonth = $today->format("n");
$currentyear = $today->format("Y");
$drawHourLine = $day == $currentday && $month == $currentmonth && $year == $currentyear;
$dtv = DateTimeValueLib::make(0, 0, 0, $month, $day, $year);
$result = ProjectEvents::getDayProjectEvents($dtv, active_context(), $user_filter, $status_filter);
if (!$result) {
    $result = array();
}
$alldayevents = array();
$milestones = ProjectMilestones::getRangeMilestones($dtv, $dtv);
if ($task_filter != "hide") {
    $tasks = ProjectTasks::getRangeTasksByUser($dtv, $dtv, $user_filter != -1 ? $user : null, $task_filter);
}
if (user_config_option('show_birthdays_in_calendar')) {
    $birthdays = Contacts::instance()->getRangeContactsByBirthday($dtv, $dtv, active_context_members(false));
} else {
    $birthdays = array();
}
foreach ($result as $key => $event) {
    if ($event->getTypeId() > 1) {
        $alldayevents[] = $event;
        unset($result[$key]);
    }
}
if ($milestones) {
    $alldayevents = array_merge($alldayevents, $milestones);
}
if (isset($tasks)) {
    $tmp_tasks = array();
    $dtv_end = new DateTimeValue($dtv->getTimestamp() + 60 * 60 * 24);
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:31,代码来源:viewdate.php

示例5: quick_add_task

 function quick_add_task()
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $notAllowedMember = '';
     if (!ProjectTask::canAdd(logged_user(), active_context(), $notAllowedMember)) {
         if (str_starts_with($notAllowedMember, '-- req dim --')) {
             flash_error(lang('must choose at least one member of', str_replace_first('-- req dim --', '', $notAllowedMember, $in)));
         } else {
             flash_error(lang('no context permissions to add', lang("tasks"), $notAllowedMember));
         }
         ajx_current("empty");
         return;
     }
     ajx_current("empty");
     $task = new ProjectTask();
     $task_data = array_var($_POST, 'task');
     $parent_id = array_var($task_data, 'parent_id', 0);
     $parent = ProjectTasks::findById($parent_id);
     if (is_array($task_data)) {
         $task_data['due_date'] = getDateValue(array_var($task_data, 'task_due_date'));
         $task_data['start_date'] = getDateValue(array_var($task_data, 'task_start_date'));
         if ($task_data['due_date'] instanceof DateTimeValue) {
             $duetime = getTimeValue(array_var($task_data, 'task_due_time'));
             if (is_array($duetime)) {
                 $task_data['due_date']->setHour(array_var($duetime, 'hours'));
                 $task_data['due_date']->setMinute(array_var($duetime, 'mins'));
             }
             $task_data['due_date']->advance(logged_user()->getTimezone() * -3600);
             $task_data['use_due_time'] = is_array($duetime);
         }
         if ($task_data['start_date'] instanceof DateTimeValue) {
             $starttime = getTimeValue(array_var($task_data, 'task_start_time'));
             if (is_array($starttime)) {
                 $task_data['start_date']->setHour(array_var($starttime, 'hours'));
                 $task_data['start_date']->setMinute(array_var($starttime, 'mins'));
             }
             $task_data['start_date']->advance(logged_user()->getTimezone() * -3600);
             $task_data['use_start_time'] = is_array($starttime);
         }
         if (config_option("wysiwyg_tasks")) {
             $task_data['type_content'] = "html";
             $task_data['text'] = preg_replace("/[\n|\r|\n\r]/", '', array_var($task_data, 'text'));
         } else {
             $task_data['type_content'] = "text";
         }
         $task_data['object_type_id'] = $task->getObjectTypeId();
         $task->setFromAttributes($task_data);
         if (array_var($task_data, 'is_completed', false) == 'true') {
             $task->setCompletedOn(DateTimeValueLib::now());
             $task->setCompletedById(logged_user()->getId());
         }
         try {
             DB::beginWork();
             $task->save();
             $totalMinutes = array_var($task_data, 'hours') * 60 + array_var($task_data, 'minutes');
             $task->setTimeEstimate($totalMinutes);
             $task->save();
             $gb_member_id = array_var($task_data, 'member_id');
             $member_ids = array();
             $persons_dim = Dimensions::findByCode('feng_persons');
             $persons_dim_id = $persons_dim instanceof Dimension ? $persons_dim->getId() : 0;
             if ($parent) {
                 if (count($parent->getMembers()) > 0) {
                     foreach ($parent->getMembers() as $member) {
                         if ($member->getDimensionId() != $persons_dim_id) {
                             $member_ids[] = $member->getId();
                         }
                     }
                 }
                 $task->setMilestoneId($parent->getMilestoneId());
                 $task->save();
             }
             if (count($member_ids) == 0) {
                 $member_ids = active_context_members(false);
             }
             if ($gb_member_id && is_numeric($gb_member_id)) {
                 $member_ids[] = $gb_member_id;
             }
             $object_controller = new ObjectController();
             $object_controller->add_to_members($task, $member_ids);
             //Add new work timeslot for this task
             //				if (array_var($task_data,'hours') != '' && array_var($task_data,'hours') > 0){
             //					$hours = array_var($task_data, 'hours');
             //					$hours = - $hours;
             //
             //					$timeslot = new Timeslot();
             //					$dt = DateTimeValueLib::now();
             //					$dt2 = DateTimeValueLib::now();
             //					$timeslot->setEndTime($dt);
             //					$dt2 = $dt2->add('h', $hours);
             //					$timeslot->setStartTime($dt2);
             //					$timeslot->setContactId(logged_user()->getId());
             //					$timeslot->setObjectId($task->getId());
             //					$timeslot->save();
             //				}
             ApplicationLogs::createLog($task, ApplicationLogs::ACTION_ADD);
//.........这里部分代码省略.........
开发者ID:rorteg,项目名称:fengoffice,代码行数:101,代码来源:TaskController.class.php

示例6: get_rendered_member_selectors

 function get_rendered_member_selectors()
 {
     $object_members = array();
     $objectId = 0;
     if (get_id()) {
         $object = Objects::findObject(get_id());
         $object_type_id = $object->manager()->getObjectTypeId();
         $object_members = $object->getMemberIds();
         $objectId = get_id();
     } else {
         $object_type_id = array_var($_GET, 'objtypeid');
         if (array_var($_GET, 'members')) {
             $object_members = explode(',', array_var($_GET, 'members'));
         }
     }
     if (count($object_members) == 0) {
         $object_members = active_context_members(false);
     }
     $genid = array_var($_GET, 'genid');
     $listeners = array();
     //ob_start — Turn on output buffering
     //no output is sent from the script (other than headers), instead the output is stored in an internal buffer.
     ob_start();
     //get skipped dimensions for this view
     $view_name = array_var($_GET, 'view_name');
     $dimensions_to_show = explode(",", user_config_option($view_name . "_view_dimensions_combos"));
     $dimensions_to_skip = array_diff(get_user_dimensions_ids(), $dimensions_to_show);
     render_member_selectors($object_type_id, $genid, $object_members, array('listeners' => $listeners), $dimensions_to_skip, null, false);
     ajx_current("empty");
     //Gets the current buffer contents and delete current output buffer.
     //ob_get_clean() essentially executes both ob_get_contents() and ob_end_clean().
     ajx_extra_data(array("htmlToAdd" => ob_get_clean()));
     ajx_extra_data(array("objectId" => $objectId));
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:34,代码来源:MemberController.class.php

示例7: implode

<?php

$members = implode(',', active_context_members(false));
$ws_dim = Dimensions::findByCode('workspaces');
?>

<div class="ws-widget widget">

	<div class="widget-header" onclick="og.dashExpand('<?php 
echo $genid;
?>
');">
		<?php 
echo lang('workspaces');
?>
		<div class="dash-expander ico-dash-expanded" id="<?php 
echo $genid;
?>
expander"></div>
	</div>
	
	<div class="widget-body" id="<?php 
echo $genid;
?>
_widget_body" >
	
		<div class="project-list">
		<?php 
foreach ($data_ws as $ws) {
    ?>
			<div class="project-row-container">
开发者ID:rorteg,项目名称:fengoffice,代码行数:31,代码来源:template.php

示例8:

<?php

// Render only when no context is selected
if (!count(active_context_members(false))) {
    // Make calcs, call models, controllers
    $limit = 5;
    $result = Contacts::instance()->listing(array("order" => "name", "order_dir" => "asc", "extra_conditions" => " AND `is_company` = 0 AND disabled = 0 ", "start" => 0, "limit" => $limit));
    $total = $result->total;
    $contacts = $result->objects;
    $render_add = can_manage_security(logged_user());
    $genid = gen_id();
    include_once 'template.php';
}
开发者ID:rorteg,项目名称:fengoffice,代码行数:13,代码来源:index.php

示例9: user_config_option

/**
 * Return user config option value
 *
 * @access public
 * @param string $name Option name
 * @param mixed $default Default value that is returned in case of any error
 * @param int $user_id User Id, if null logged user is taken
 * @return mixed
 */
function user_config_option($option, $default = null, $user_id = null, $options_members = false) {
	if (is_null($user_id)) {
		if (logged_user() instanceof Contact) {
			$user_id = logged_user()->getId();
		} else if (is_null($default)) {
			$def_value = null;
			// check the cache for the option default value
			if (GlobalCache::isAvailable()) {
				$def_value = GlobalCache::get('user_config_option_def_'.$option, $success);
				if ($success) return $def_value;
			}
			// default value not found in cache
			$def_value = ContactConfigOptions::getDefaultOptionValue($option, $default);
			if (GlobalCache::isAvailable()) {
				GlobalCache::update('user_config_option_def_'.$option, $def_value);
			}
			return $def_value;
		} else {
			return $default;
		}
	}
	
	// check the cache for the option value
	if (GlobalCache::isAvailable()) {
		$option_value = GlobalCache::get('user_config_option_'.$user_id.'_'.$option, $success);
		if ($success) return $option_value;
	}
        
        if($options_members){
            $members = implode ( ',',active_context_members(false));
            // default value not found in cache
            $option_value = ContactConfigOptions::getOptionValue($option, $user_id, $default, $members);
        }else{
            $option_value = ContactConfigOptions::getOptionValue($option, $user_id, $default);
        }
	if (GlobalCache::isAvailable()) {
		GlobalCache::update('user_config_option_'.$user_id.'_'.$option, $option_value);
	}
	
	return $option_value;
} // user_config_option
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:50,代码来源:functions.php

示例10: render_member_selectors

function render_member_selectors($content_object_type_id, $genid = null, $selected_member_ids = null, $options = array(), $skipped_dimensions = null, $simulate_required = null, $default_view = true)
{
    if (is_numeric($content_object_type_id)) {
        if (is_null($genid)) {
            $genid = gen_id();
        }
        $user_dimensions = get_user_dimensions_ids();
        // User allowed dimensions
        $dimensions = array();
        // Diemsions for this content type
        if ($all_dimensions = Dimensions::getAllowedDimensions($content_object_type_id)) {
            foreach ($all_dimensions as $dimension) {
                if (isset($user_dimensions[$dimension['dimension_id']])) {
                    $custom_name = DimensionOptions::getOptionValue($dimension['dimension_id'], 'custom_dimension_name');
                    $dimension['dimension_name'] = $custom_name && trim($custom_name) != "" ? $custom_name : lang($dimension['dimension_code']);
                    $dimensions[] = $dimension;
                }
            }
        }
        if ($dimensions != null && count($dimensions)) {
            if (is_null($selected_member_ids) && array_var($options, 'select_current_context')) {
                $context = active_context();
                $selected_member_ids = array();
                foreach ($context as $selection) {
                    if ($selection instanceof Member) {
                        $selected_member_ids[] = $selection->getId();
                    }
                }
            }
            if (is_null($selected_member_ids)) {
                $selected_member_ids = array();
            }
            $skipped_dimensions_cond = "";
            if (is_array($skipped_dimensions) && count($skipped_dimensions) > 0) {
                $skipped_dimensions_cond = " AND dimension_id NOT IN (" . implode(',', $skipped_dimensions) . ")";
            }
            // Set view variables
            $manageable_conds = ' AND dimension_id IN (SELECT id from ' . TABLE_PREFIX . 'dimensions WHERE is_manageable=1)' . $skipped_dimensions_cond;
            $selected_members = count($selected_member_ids) > 0 ? Members::findAll(array('conditions' => 'id IN (' . implode(',', $selected_member_ids) . ') ' . $manageable_conds)) : array();
            $selected_member_ids = array();
            foreach ($selected_members as $sm) {
                $selected_member_ids[] = $sm->getId();
            }
            $selected_members_json = "[" . implode(',', $selected_member_ids) . "]";
            $component_id = "{$genid}-member-selectors-panel-{$content_object_type_id}";
            $object_is_new = is_null($selected_members);
            $listeners = array_var($options, 'listeners', array());
            $allowed_member_type_ids = array_var($options, 'allowedMemberTypes', null);
            $initial_selected_members = $selected_members;
            if (count($initial_selected_members) == 0) {
                $selected_context_member_ids = active_context_members(false);
                if (count($selected_context_member_ids) > 0) {
                    $initial_selected_members = Members::findAll(array('conditions' => 'id IN (' . implode(',', $selected_context_member_ids) . ')'));
                }
            }
            $tmp = array();
            foreach ($initial_selected_members as $ism) {
                if ($ism->getDimension()->getIsManageable()) {
                    $tmp[] = $ism;
                }
            }
            $initial_selected_members = $tmp;
            // Render view
            include get_template_path("components/multiple_dimension_selector", "dimension");
        }
    }
}
开发者ID:abhinay100,项目名称:feng_app,代码行数:67,代码来源:dimension.php

示例11: search

	/**
	 * Execute search
	 * TODO: Performance gus: 
	 * Fetch only ids and execute a select statement by pk (fer each result)
	 * @param void
	 * @return null
	 */
	function search() {
		// Init vars
		$search_for = array_var($_GET, 'search_for');
        $search_dimension = array_var($_GET, 'search_dimension');
        $advanced = array_var($_GET, 'advanced');
		$minWordLength = $this->minWordLength($search_for);
		$useLike = ( $minWordLength && ($this->ignoreMinWordLength) && ($minWordLength < self::$MYSQL_MIN_WORD_LENGHT) );
		$search_pieces= explode(" ", $search_for);
		$search_string = "";
		if (!$useLike){
			// Prepare MATCH AGAINST string
			foreach ($search_pieces as $word ) {
				if (( strpos($word, "@") || strpos($word, ".") || strpos($word, ",")) === false ) {
					// STRING Dont containt special characheters that mysql use as separator. Noramal  flow 
					if ($this->wildCardSearch) {
						$word.="*";
					}
				}else{
					$word =  str_replace($this->mysqlWordSeparator, " +", $word) ;
				}
				if ( !str_starts_with($word, " ") ) {
					$word = " +".$word;
				}
				$search_string .= mysql_real_escape_string( $word ). " ";
			}
			$search_string = substr($search_string, 0 , -1);
		}else{
			// USE Like Query
			$search_string = mysql_real_escape_string($search_for, DB::connection()->getLink());
		}
		
		$this->search_for = $search_for;
		$limit = $this->limit;
		$start = array_var($_REQUEST, 'start' , $this->start);
		$this->start = $start;
		$limitTest = max( $this->limitTest , $this->limit);
		$filteredResults = 0;
		$uid = logged_user()->getId();
		
		if(!isset($search_dimension)){
			$members = active_context_members(false);
		}else{
			if($search_dimension == 0){
				$members = array();
			}else{
				$members = array($search_dimension);
			}
		}
		
		// click on search everywhere
		if (array_var($_REQUEST, 'search_all_projects')) {
			$members = array();
		}
		
		$revisionObjectTypeId = ObjectTypes::findByName("file revision")->getId();
		
		$members_sql = "";
		if(count($members) > 0){
			$members_sql = "AND (rel_object_id IN (SELECT object_id FROM " . TABLE_PREFIX . "object_members om 
					WHERE member_id IN (" . implode ( ',', $members ) . ") GROUP BY object_id HAVING count(member_id) = ".count($members).")
				OR o.object_type_id = $revisionObjectTypeId AND rel_object_id IN (SELECT fr.object_id FROM " . TABLE_PREFIX . "object_members om 
					INNER JOIN ".TABLE_PREFIX."project_file_revisions fr ON om.object_id=fr.file_id 
					WHERE member_id IN (" . implode ( ',', $members ) . ") GROUP BY object_id HAVING count(member_id) = ".count($members)."))";
			$this->search_dimension = implode ( ',', $members );
		}else{
			$this->search_dimension = 0;
		}

		$listableObjectTypeIds = implode(",",ObjectTypes::getListableObjectTypeIds());
		
		if($_POST) {
			
			$conditions = array_var($_POST, 'conditions');
			$search = array_var($_POST, 'search');
			$type_object = array_var($search, 'search_object_type_id');
			if(!is_array($conditions)) $conditions = array();
			$where_condiition = '';
			$conditions_view = array();
			$cont = 0;
			$joincp ="";
			foreach($conditions as $condition){
				$condValue = array_key_exists('value', $condition) ? $condition['value'] : '';
				if($condition['field_type'] == 'boolean'){
					$value = array_key_exists('value', $condition);
				}else if($condition['field_type'] == 'date'){
					if ($condValue != '') {
						$dtFromWidget = DateTimeValueLib::dateFromFormatAndString(user_config_option('date_format'), $condValue);
						$value = date("m/d/Y", $dtFromWidget->getTimestamp());
					}
				}else{
					$value = mysql_real_escape_string($condValue, DB::connection()->getLink());
				}				
				$condition_condition = mysql_real_escape_string(array_var($condition, 'condition'), DB::connection()->getLink());
//.........这里部分代码省略.........
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:SearchController.class.php

示例12: gen_id

<?php

$genid = gen_id();
$typeId = ObjectTypes::instance()->findByName("workspace")->getId();
//Check if There is a workspace in the active context
/* @var $member Member */
foreach (active_context_members(false) as $memberId) {
    $member = Members::instance()->findById($memberId);
    if ($member->getObjectTypeId() == $typeId) {
        $id = $member->getObjectId();
        if ($workspace = Workspaces::instance()->findById($id) && trim($member->getDescription()) != "") {
            $description = $member->getDescription();
            include_once 'template.php';
            break;
        }
    }
}
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:17,代码来源:index.php

示例13: general_search

 function general_search()
 {
     // Init vars
     $search_dimension = array_var($_GET, 'search_dimension');
     $filteredResults = 0;
     $uid = logged_user()->getId();
     if (!isset($search_dimension)) {
         $members = active_context_members(false);
     } else {
         if ($search_dimension == 0) {
             $members = array();
         } else {
             $members = array($search_dimension);
         }
     }
     // click on search everywhere
     if (array_var($_REQUEST, 'search_all_projects')) {
         $members = array();
     }
     $revisionObjectTypeId = ObjectTypes::findByName("file revision")->getId();
     $members_sql = "";
     if (count($members) > 0) {
         $context_condition = "(EXISTS\r\n\t\t\t\t\t\t\t\t\t\t(SELECT om.object_id\r\n\t\t\t\t\t\t\t\t\t\t\tFROM  " . TABLE_PREFIX . "object_members om\r\n\t\t\t\t\t\t\t\t\t\t\tWHERE\tom.member_id IN (" . implode(',', $members) . ") AND so.rel_object_id = om.object_id\r\n\t\t\t\t\t\t\t\t\t\t\tGROUP BY object_id\r\n\t\t\t\t\t\t\t\t\t\t\tHAVING count(member_id) = " . count($members) . "\r\n\t\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\t)";
         $context_condition_rev = "(EXISTS\r\n\t\t\t\t\t\t\t\t\t\t(SELECT fr.object_id FROM " . TABLE_PREFIX . "object_members om\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . TABLE_PREFIX . "project_file_revisions fr ON om.object_id=fr.file_id\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . TABLE_PREFIX . "objects ob ON fr.object_id=ob.id\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE fr.file_id = so.rel_object_id AND ob.object_type_id = {$revisionObjectTypeId} AND member_id IN (" . implode(',', $members) . ")\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGROUP BY object_id\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tHAVING count(member_id) = " . count($members) . "\r\n\t\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\t)";
         $members_sql = "AND ( " . $context_condition . " OR  " . $context_condition_rev . ")";
         $this->search_dimension = implode(',', $members);
     } else {
         $this->search_dimension = 0;
     }
     $listableObjectTypeIds = implode(",", ObjectTypes::getListableObjectTypeIds());
     $can_see_all_tasks_cond = "";
     if (!SystemPermissions::userHasSystemPermission(logged_user(), 'can_see_assigned_to_other_tasks')) {
         $can_see_all_tasks_cond = " AND IF((SELECT ot.name FROM " . TABLE_PREFIX . "object_types ot WHERE ot.id=o.object_type_id)='task',\r\n\t\t\t (SELECT t.assigned_to_contact_id FROM " . TABLE_PREFIX . "project_tasks t WHERE t.object_id=o.id) = " . logged_user()->getId() . ",\r\n\t\t\t true)";
     }
     $search_string = trim(array_var($_REQUEST, 'query', ''));
     $search_string = mysql_real_escape_string($search_string, DB::connection()->getLink());
     $start = array_var($_REQUEST, 'start', 0);
     $orig_limit = array_var($_REQUEST, 'limit');
     $limit = $orig_limit + 1;
     $useLike = false;
     if (user_config_option("search_engine") == 'like') {
         $useLike = true;
     }
     if (strlen($search_string) < 4) {
         $useLike = true;
     }
     if (strlen($search_string) > 0) {
         $this->search_for = $search_string;
         $logged_user_pgs = implode(',', logged_user()->getPermissionGroupIds());
         $sql = "\r\n\t\t\tSELECT DISTINCT so.rel_object_id AS id, so.content AS text_match, so.column_name AS field_match\r\n\t\t\tFROM " . TABLE_PREFIX . "searchable_objects so\r\n\t\t\tWHERE " . ($useLike ? " so.content LIKE '%{$search_string}%' " : " MATCH (so.content) AGAINST ('\"{$search_string}\"' IN BOOLEAN MODE) ") . "\r\n\t\t\tAND (EXISTS\r\n\t\t\t\t(SELECT o.id\r\n\t\t\t\t FROM  " . TABLE_PREFIX . "objects o\r\n\t\t\t\t\t\t\t WHERE\to.id = so.rel_object_id AND (\r\n\t\t\t\t\t\t\t (o.object_type_id = {$revisionObjectTypeId} AND\r\n\t\t\t\t\t\t\t EXISTS (\r\n\t\t\t\t\t\t\t SELECT group_id FROM " . TABLE_PREFIX . "sharing_table WHERE object_id  = ( SELECT file_id FROM " . TABLE_PREFIX . "project_file_revisions WHERE object_id = o.id )\r\n\t\t\t\t\t\t\t\t\tAND group_id IN ({$logged_user_pgs})\r\n\t\t\t\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\t\t\t\tOR (\r\n\t\t\t\t\t\t\t\t\t\t\t\t(EXISTS\r\n\t\t\t\t\t\t\t\t\t\t\t\t(SELECT object_id\r\n\t\t\t\t\t\t\t\t\t\t\t\tFROM  " . TABLE_PREFIX . "sharing_table sh\r\n\t\t\t\t\t\t\t\t\t\tWHERE o.id = sh.object_id\r\n\t\t\t\t\t\t\t\t\t\tAND sh.group_id  IN (\r\n\t\t\t\t\t\t\t\t\t\t\t{$logged_user_pgs}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) AND o.object_type_id IN ({$listableObjectTypeIds}) " . $members_sql . $can_see_all_tasks_cond . "\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\tGROUP BY(id)\t\r\n\t\t\t\t\t\tORDER BY(id) DESC\t\t\t\t\t\t\t\r\n\t\t\t\t\t\tLIMIT {$start}, {$limit}";
         $rows = DB::executeAll($sql);
         if (!is_array($rows)) {
             $rows = array();
         }
         // show more
         $show_more = false;
         if (count($rows) > $orig_limit) {
             array_pop($rows);
             $show_more = true;
         }
         if ($show_more) {
             ajx_extra_data(array('show_more' => $show_more));
         }
         $search_results = array();
         $object_ids = array();
         foreach ($rows as $ob_data) {
             // basic data
             $data = array('id' => $ob_data['id'], 'text_match' => $this->highlightOneResult($ob_data['text_match']), 'field_match' => $ob_data['field_match']);
             $object_ids[] = $ob_data['id'];
             $search_results[] = $data;
         }
         if (count($object_ids) > 0) {
             $result = ContentDataObjects::listing(array("extra_conditions" => " AND o.id IN (" . implode(",", $object_ids) . ") ", "include_deleted" => true));
             $objects = $result->objects;
             foreach ($objects as $object) {
                 foreach ($search_results as $key => $search_result) {
                     if ($search_result['id'] == $object->getId()) {
                         $search_results[$key]['name'] = $object->getObjectName();
                         $class = 'ico-' . $object->getObjectTypeName();
                         $search_results[$key]['iconCls'] = $class;
                         $search_results[$key]['url'] = $object->getViewUrl();
                         continue;
                     }
                 }
             }
         }
         $row = "search-result-row-medium";
         ajx_extra_data(array('row_class' => $row));
         ajx_extra_data(array('search_results' => $search_results));
     }
     ajx_current("empty");
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:92,代码来源:SearchController.class.php

示例14: index

 function index()
 {
     $tasksUserId = array_var($_GET, 'tu');
     if (is_null($tasksUserId)) {
         $tasksUserId = user_config_option('TM tasks user filter', logged_user()->getId());
     } else {
         if (user_config_option('TM tasks user filter') != $tasksUserId) {
             set_user_config_option('TM tasks user filter', $tasksUserId, logged_user()->getId());
         }
     }
     $timeslotsUserId = array_var($_GET, 'tsu');
     if (is_null($timeslotsUserId)) {
         $timeslotsUserId = user_config_option('TM user filter', 0);
     } else {
         if (user_config_option('TM user filter') != $timeslotsUserId) {
             set_user_config_option('TM user filter', $timeslotsUserId, logged_user()->getId());
         }
     }
     if (!SystemPermissions::userHasSystemPermission(logged_user(), 'can_see_assigned_to_other_tasks')) {
         $timeslotsUserId = logged_user()->getId();
     }
     $showTimeType = array_var($_GET, 'stt');
     if (is_null($showTimeType)) {
         $showTimeType = user_config_option('TM show time type', 0);
     } else {
         if (user_config_option('TM show time type') != $showTimeType) {
             set_user_config_option('TM show time type', $showTimeType, logged_user()->getId());
         }
     }
     $start = array_var($_GET, 'start', 0);
     $limit = 20;
     $tasksUser = Contacts::findById($tasksUserId);
     $timeslotsUser = Contacts::findById($timeslotsUserId);
     //Active tasks view
     $open_timeslots = Timeslots::instance()->listing(array("extra_conditions" => " AND end_time = '" . EMPTY_DATETIME . "' AND contact_id = " . $tasksUserId))->objects;
     $tasks = array();
     foreach ($open_timeslots as $open_timeslot) {
         $task = ProjectTasks::findById($open_timeslot->getRelObjectId());
         if ($task instanceof ProjectTask && !$task->isCompleted() && !$task->isTrashed() && !$task->isArchived()) {
             $tasks[] = $task;
         }
     }
     ProjectTasks::populateTimeslots($tasks);
     //Timeslots view
     $total = 0;
     switch ($showTimeType) {
         case 0:
             //Show only timeslots added through the time panel
             $result = Timeslots::getGeneralTimeslots(active_context(), $timeslotsUser, $start, $limit);
             $timeslots = $result->objects;
             $get_total = Timeslots::getGeneralTimeslots(active_context(), $timeslotsUser, $start, $limit, true);
             $total = $get_total->total;
             break;
         default:
             throw new Error('Unrecognised TM show time type: ' . $showTimeType);
     }
     //Get Users Info
     $users = array();
     $context = active_context();
     if (!can_manage_time(logged_user())) {
         if (can_add(logged_user(), $context, Timeslots::instance()->getObjectTypeId())) {
             $users = array(logged_user());
         }
     } else {
         if (logged_user()->isMemberOfOwnerCompany()) {
             $users = Contacts::getAllUsers();
         } else {
             $users = logged_user()->getCompanyId() > 0 ? Contacts::getAllUsers(" AND `company_id` = " . logged_user()->getCompanyId()) : array(logged_user());
         }
         // filter users by permissions only if any member is selected.
         $selected_members = active_context_members(false);
         if (count($selected_members) > 0) {
             $tmp_users = array();
             foreach ($users as $user) {
                 if (can_add($user, $context, Timeslots::instance()->getObjectTypeId())) {
                     $tmp_users[] = $user;
                 }
             }
             $users = $tmp_users;
         }
     }
     //Get Companies Info
     if (logged_user()->isMemberOfOwnerCompany() || logged_user()->isAdminGroup()) {
         $companies = Contacts::getCompaniesWithUsers();
     } else {
         $companies = array();
         if (logged_user()->getCompanyId() > 0) {
             $companies[] = logged_user()->getCompany();
         }
     }
     $required_dimensions = DimensionObjectTypeContents::getRequiredDimensions(Timeslots::instance()->getObjectTypeId());
     $draw_inputs = !$required_dimensions || count($required_dimensions) == 0;
     if (!$draw_inputs) {
         $ts_ots = DimensionObjectTypeContents::getDimensionObjectTypesforObject(Timeslots::instance()->getObjectTypeId());
         $context = active_context();
         foreach ($context as $sel) {
             if ($sel instanceof Member) {
                 foreach ($ts_ots as $ts_ot) {
                     if ($sel->getDimensionId() == $ts_ot->getDimensionId() && $sel->getObjectTypeId() == $ts_ot->getDimensionObjectTypeId()) {
                         $draw_inputs = true;
//.........这里部分代码省略.........
开发者ID:abhinay100,项目名称:feng_app,代码行数:101,代码来源:TimeController.class.php

示例15: quick_add_multiple_files

 /**
  * quick_add_multiple_files
  * Use this function to upload multiple files
  * @access public
  * @param null
  */
 function quick_add_multiple_files()
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $file_data = array_var($_POST, 'file');
     $file = new ProjectFile();
     tpl_assign('file', $file);
     tpl_assign('file_data', $file_data);
     tpl_assign('genid', array_var($_GET, 'genid'));
     tpl_assign('object_id', array_var($_GET, 'object_id'));
     tpl_assign('composing_mail', array_var($_GET, 'composing_mail'));
     if (is_array(array_var($_POST, 'file'))) {
         //$this->setLayout("html");
         $upload_option = array_var($file_data, 'upload_option', -1);
         try {
             //members
             $member_ids = array();
             $object_controller = new ObjectController();
             if (count(active_context_members(false)) > 0) {
                 $member_ids = active_context_members(false);
             } elseif (array_var($file_data, 'member_ids')) {
                 $member_ids = explode(',', array_var($file_data, 'member_ids'));
                 if (is_numeric($member_ids) && $member_ids > 0) {
                     $member_ids = array($member_ids);
                 }
             } elseif (array_var($file_data, 'object_id')) {
                 $object = Objects::findObject(array_var($file_data, 'object_id'));
                 if ($object instanceof ContentDataObject) {
                     $member_ids = $object->getMemberIds();
                 } else {
                     // add only to logged_user's person member
                 }
             } else {
                 // add only to logged_user's person member
             }
             $upload_id = array_var($file_data, 'upload_id');
             $uploaded_file = array_var($_SESSION, $upload_id, array());
             //files ids to return
             $file_ids = array();
             if (isset($uploaded_file['name']) && is_array($uploaded_file['name'])) {
                 foreach ($uploaded_file['name'] as $key => $file_name) {
                     if (count($uploaded_file['name']) == 1 && array_var($file_data, 'name') != "" && array_var($file_data, 'name') != $file_name) {
                         $file_name = array_var($file_data, 'name');
                     }
                     $file_data_mult = $file_data;
                     $file_data_mult['name'] = $file_name;
                     $uploaded_file_mult['name'] = $file_name;
                     $uploaded_file_mult['size'] = $uploaded_file['size'][$key];
                     $uploaded_file_mult['type'] = $uploaded_file['type'][$key];
                     $uploaded_file_mult['tmp_name'] = $uploaded_file['tmp_name'][$key];
                     $uploaded_file_mult['error'] = $uploaded_file['error'][$key];
                     if (count($uploaded_file['name']) != 1) {
                         $upload_option = -1;
                     }
                     $file_ids[] = $this->add_file_from_multi($file_data_mult, $uploaded_file_mult, $member_ids, $upload_option);
                 }
             }
             unset($_SESSION[$upload_id]);
             //data to return
             $files_data_to_return = array();
             foreach ($file_ids as $file_id) {
                 $file_to_ret = ProjectFiles::findById($file_id);
                 if (!$file_to_ret instanceof ProjectFile) {
                     continue;
                 }
                 $file_data = array();
                 $file_data["file_id"] = $file_to_ret->getId();
                 $file_data["file_name"] = $file_to_ret->getFilename();
                 $file_data["icocls"] = 'ico-file ico-' . str_replace(".", "_", str_replace("/", "-", $file_to_ret->getTypeString()));
                 $files_data_to_return[] = $file_data;
             }
             ajx_extra_data(array("files_data" => $files_data_to_return));
             ajx_current("empty");
         } catch (Exception $e) {
             flash_error($e->getMessage());
             ajx_current("empty");
         }
         // try
     }
     // if
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:90,代码来源:FilesController.class.php


注:本文中的active_context_members函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。