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


PHP array_var函数代码示例

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


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

示例1: smarty_function_object_tags

/**
 * Render object tags
 *
 * Parameters:
 * 
 * - object - Selected object
 * - project - Selected project, if not present we'll get it from 
 *   $object->getProject()
 * 
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_object_tags($params, &$smarty)
{
    $object = array_var($params, 'object');
    if (!instance_of($object, 'ProjectObject')) {
        return new InvalidParamError('object', $object, '$object is expected to be an instance of ProjectObject class', true);
    }
    // if
    $project = array_var($params, 'project');
    if (!instance_of($project, 'Project')) {
        $project = $object->getProject();
    }
    // if
    if (!instance_of($project, 'Project')) {
        return new InvalidParamError('project', $project, '$project is expected to be an instance of Project class', true);
    }
    // if
    $tags = $object->getTags();
    if (is_foreachable($tags)) {
        $prepared = array();
        foreach ($tags as $tag) {
            if (trim($tag)) {
                $prepared[] = '<a href="' . Tags::getTagUrl($tag, $project) . '">' . clean($tag) . '</a>';
            }
            // if
        }
        // if
        return implode(', ', $prepared);
    } else {
        return '<span class="no_tags">' . lang('-- No tags --') . '</span>';
    }
    // if
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:45,代码来源:function.object_tags.php

示例2: format_single_file

	static function format_single_file($object_info, $id_prefix="") {
		$html .= "<table class='file_info_container' id='{$id_prefix}file_info_container' cellpadding='0' cellspacing='5'>";
		
		$html .= "<tr><td><img class='view_file_icon' src='".array_var($object_info, 'icon_l')."' alt='icon' /></td>";
		$html .= "<td><div class='file_name'>".array_var($object_info, 'name')."</div>";
		
		$upd_by = array_var($object_info, 'updated_by') . " - ".array_var($object_info, 'updated_on');
		$html .= "<div class='file_updated'>".lang('modified by').": $upd_by</div></td>";
		$html .= "</tr></table>";
		
		$revisions = array_var($object_info, 'revisions');
		if (is_array($revisions)) {
			$html .= "<div class='revisions_title'>".lang('revisions')."</div>";
			$html .= "<table class='revisions_container' id='{$id_prefix}revisions_container' cellpadding='0' cellspacing='5'>";
			foreach ($revisions as $revision) {
				$html .= "<tr class='revision_info_container'>";
				$html .= "<td class='revision_info_number'>#".array_var($revision, 'number')."</td>";
				$html .= "<td class='revision_info_name'>".array_var($revision, 'created_by')." - ".array_var($revision, 'created_on')."</td>";
				$html .= "<td class='revision_info_download'>".array_var($revision, 'download_link')."</td>";
				if (strlen(array_var($revision, 'comment', '')) > 0)
					$html .= "</tr><tr><td colspan='3' class='revision_info_comment'>".lang('comment').": ".array_var($revision, 'comment')."</td>";
				$html .= "</tr>";
			}
			$html .= "</table>";
		}
		
		return $html;
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:28,代码来源:FengApiFormat.class.php

示例3: test_svn

 /**
  * Ajax that will return response from command line
  *
  * @param void
  * @return null
  */
 function test_svn()
 {
     $path = array_var($_GET, 'svn_path', null);
     $check_executable = RepositoryEngine::executableExists($path);
     echo $check_executable === true ? 'true' : $check_executable;
     die;
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:13,代码来源:SourceAdminController.class.php

示例4: smarty_function_select_page

/**
 * Render select page control
 * 
 * Parameters:
 * 
 * - project - Parent project
 * - value - ID of selected page
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_select_page($params, &$smarty)
{
    $project = array_var($params, 'project', null, true);
    if (!instance_of($project, 'Project')) {
        return new InvalidParamError('project', $project, '$project is expected to be an instance of Project class', true);
    }
    // if
    $user = array_var($params, 'user');
    if (!instance_of($user, 'User')) {
        return new InvalidParamError('user', $user, '$user is exepcted to be an instance of User class', true);
    }
    // if
    $options = array();
    $value = array_var($params, 'value', null, true);
    $skip = array_var($params, 'skip');
    $categories = Categories::findByModuleSection($project, PAGES_MODULE, 'pages');
    if (is_foreachable($categories)) {
        foreach ($categories as $category) {
            $option_attributes = $category->getId() == $value ? array('selected' => true) : null;
            $options[] = option_tag($category->getName(), $category->getId(), $option_attributes);
            $pages = Pages::findByCategory($category, STATE_VISIBLE, $user->getVisibility());
            if (is_foreachable($pages)) {
                foreach ($pages as $page) {
                    smarty_function_select_page_populate_options($page, $value, $user, $skip, $options, '- ');
                }
                // foreach
            }
            // if
        }
        // foreach
    }
    // if
    return select_box($options, $params);
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:46,代码来源:function.select_page.php

示例5: connection

 /**
  * This function will return specific connection. If $connection_name is NULL primary connection will be used
  *
  * @access public
  * @param string $connection_name Connection name, if NULL primary connection will be used
  * @return AbstractDBAdapter
  */
 static function connection($connection_name = null)
 {
     if (is_null($connection_name)) {
         $connection_name = self::getPrimaryConnection();
     }
     return array_var(self::$connections, $connection_name);
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:14,代码来源:DB.class.php

示例6: smarty_function_user_link

/**
 * Display user name with a link to users profile
 * 
 * - user - User - We create link for this User
 * - short - boolean - Use short display name
 * 
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_user_link($params, &$smarty)
{
    static $cache = array();
    $user = array_var($params, 'user');
    $short = array_var($params, 'short', false);
    // User instance
    if (instance_of($user, 'User')) {
        if (!isset($cache[$user->getId()])) {
            //BOF:mod 20121030
            /*
            //EOF:mod 20121030
                    $cache[$user->getId()] = '<a href="' . $user->getViewUrl() . '" class="user_link">' . clean($user->getDisplayName($short)) . '</a>';
            //BOF:mod 20121030
            */
            $cache[$user->getId()] = '<a href="' . $user->getViewUrl() . '" class="user_link">' . clean($user->getDisplayName()) . '</a>';
            //EOF:mod 20121030
        }
        // if
        return $cache[$user->getId()];
        // AnonymousUser instance
    } elseif (instance_of($user, 'AnonymousUser') && trim($user->getName()) && is_valid_email($user->getEmail())) {
        return '<a href="mailto:' . $user->getEmail() . '" class="anonymous_user_link">' . clean($user->getName()) . '</a>';
        // Unknown user
    } else {
        return '<span class="unknow_user_link unknown_object_link">' . clean(lang('Unknown user')) . '</span>';
    }
    // if
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:38,代码来源:function.user_link.php

示例7: smarty_function_mobile_access_object_comments

/**
 * Render comments
 * 
 * Parameters:
 * 
 * - comments - comments that needs to be rendered
 * - page - current_page
 * - total_pages - total pages
 * - counter - counter for comment #
 * - url - base URL for link assembly
 * - parent - parent object
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_mobile_access_object_comments($params, &$smarty)
{
    $url_params = '';
    if (is_foreachable($params)) {
        foreach ($params as $k => $v) {
            if (strpos($k, 'url_param_') !== false && $v) {
                $url_params .= '&amp;' . substr($k, 10) . '=' . $v;
            }
            // if
        }
        // foreach
    }
    // if
    $object = array_var($params, 'object');
    if (!instance_of($object, 'ProjectObject')) {
        return new InvalidParamError('object', $object, '$object is expected to be an instance of ProjectObject class', true);
    }
    // if
    $user = array_var($params, 'user');
    if (!instance_of($user, 'User')) {
        return new InvalidParamError('object', $user, '$user is expected to be an instance of User class', true);
    }
    // if
    $page = array_var($params, 'page', 1);
    $page = (int) array_var($_GET, 'page');
    if ($page < 1) {
        $page = 1;
    }
    // if
    $counter = array_var($params, 'counter', 1);
    $counter = ($page - 1) * $object->comments_per_page + $counter;
    list($comments, $pagination) = $object->paginateComments($page, $object->comments_per_page, $user->getVisibility());
    $smarty->assign(array("_mobile_access_comments_comments" => $comments, "_mobile_access_comments_paginator" => $pagination, "_mobile_access_comments_url" => mobile_access_module_get_view_url($object), "_mobile_access_comments_url_params" => $url_params, "_mobile_access_comments_counter" => $counter, "_mobile_access_comments_show_counter" => array_var($params, 'show_counter', true)));
    return $smarty->fetch(get_template_path('_object_comments', null, MOBILE_ACCESS_MODULE));
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:51,代码来源:function.mobile_access_object_comments.php

示例8: smarty_function_object_departments

/**
 * Render object assignees list
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_object_departments($params, &$smarty)
{
    $resp = '--';
    $object = array_var($params, 'object');
    if (!instance_of($object, 'ProjectObject')) {
        return new InvalidParamError('object', $object, '$object is expected to be an instance of ProjectObject class', true);
    }
    // if
    $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
    mysql_select_db(DB_NAME, $link);
    $query = "select a.category_name, a.id from \n\t\t\t healingcrystals_project_milestone_categories a \n\t\t\t inner join healingcrystals_project_object_categories b on b.category_id=a.id \n\t\t\t inner join healingcrystals_project_objects c on c.id=b.object_id where \n\t\t\t c.id='" . $object->getId() . "' order by a.category_name";
    $result = mysql_query($query, $link);
    if (mysql_num_rows($result)) {
        $resp = '';
        while ($info = mysql_fetch_assoc($result)) {
            if (instance_of($object, 'Milestone')) {
                $resp .= '<a href="' . assemble_url('project_milestones', array('project_id' => $object->getProjectId())) . '&category_id=' . $info['id'] . '">' . $info['category_name'] . '</a>, ';
            } elseif (instance_of($object, 'Ticket')) {
                $resp .= '<a href="' . assemble_url('project_tickets', array('project_id' => $object->getProjectId())) . '&department_id=' . $info['id'] . '">' . $info['category_name'] . '</a>, ';
            } elseif (instance_of($object, 'Page')) {
                $resp .= '<a href="' . assemble_url('project_pages', array('project_id' => $object->getProjectId())) . '&category_id=' . $info['id'] . '">' . $info['category_name'] . '</a>, ';
            } else {
                $resp .= $info['category_name'] . ', ';
            }
        }
        $resp = substr($resp, 0, -2);
    }
    mysql_close($link);
    return $resp;
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:37,代码来源:function.object_departments.php

示例9: smarty_function_object_department_selection

function smarty_function_object_department_selection($params, &$smarty)
{
    $object = array_var($params, 'object');
    if (!instance_of($object, 'ProjectObject')) {
        return new InvalidParamError('object', $object, '$object is not valid instance of ProjectObject class', true);
    }
    $select = '';
    $select = '<select onchange="modify_department_association(this);">';
    $select .= '<option value="">-- Select Department --</option>';
    $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
    mysql_select_db(DB_NAME);
    $selected_department_id = '';
    $query = mysql_query("select category_id from healingcrystals_project_object_categories where object_id='" . $object->getId() . "'");
    if (mysql_num_rows($query)) {
        $info = mysql_fetch_assoc($query);
        $selected_department_id = $info['category_id'];
    }
    $query = mysql_query("select id, category_name from healingcrystals_project_milestone_categories where project_id='" . $object->getProjectId() . "' order by category_name");
    while ($entry = mysql_fetch_assoc($query)) {
        $select .= '<option value="' . $entry['id'] . '" ' . ($selected_department_id == $entry['id'] ? ' selected ' : '') . ' >' . $entry['category_name'] . '</option>';
    }
    mysql_close($link);
    $select .= '</select>';
    return $select;
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:25,代码来源:function.object_department_selection.php

示例10: smarty_function_mobile_access_object_assignees

/**
 * Render object assignees list
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_mobile_access_object_assignees($params, &$smarty)
{
    $object = array_var($params, 'object');
    if (!instance_of($object, 'ProjectObject')) {
        return new InvalidParamError('object', $object, '$object is expected to be an instance of ProjectObject class', true);
    }
    // if
    $owner = $object->getResponsibleAssignee();
    if (!instance_of($owner, 'User')) {
        Assignments::deleteByObject($object);
        return lang('No one is responsible');
    }
    // if
    require_once SYSTEM_MODULE_PATH . '/helpers/function.user_link.php';
    $other_assignees = array();
    $assignees = $object->getAssignees();
    if (is_foreachable($assignees)) {
        foreach ($assignees as $assignee) {
            if ($assignee->getId() != $owner->getId()) {
                $other_assignees[] = '<a href="' . mobile_access_module_get_view_url($assignee) . '">' . clean($assignee->getName()) . '</a>';
            }
            // if
        }
        // foreach
    }
    // if
    if (count($other_assignees)) {
        return '<a href="' . mobile_access_module_get_view_url($owner) . '">' . clean($owner->getName()) . '</a> ' . lang('is responsible') . '. ' . lang('Other assignees') . ': ' . implode(', ', $other_assignees);
    } else {
        return '<a href="' . mobile_access_module_get_view_url($owner) . '">' . clean($owner->getName()) . '</a> ' . lang('is responsible') . '.';
    }
    // if
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:40,代码来源:function.mobile_access_object_assignees.php

示例11: smarty_function_attach_files

/**
 * Render attach file to an object control
 * 
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_attach_files($params, &$smarty)
{
    static $ids = array();
    $id = array_var($params, 'id');
    if (empty($id)) {
        $counter = 1;
        do {
            $id = 'attach_files_' . $id++;
        } while (in_array($id, $ids));
    }
    // if
    $ids[] = $id;
    $max_files = (int) array_var($params, 'max_files', 1, true);
    if ($max_files < 1) {
        $max_files = 1;
    }
    // if
    require_once SMARTY_PATH . '/plugins/modifier.filesize.php';
    if ($max_files == 1) {
        $max_upload_size_message = lang('Max size of file that you can upload is :size', array('size' => smarty_modifier_filesize(get_max_upload_size())));
    } else {
        $max_upload_size_message = lang('Max total size of files you can upload is :size', array('size' => smarty_modifier_filesize(get_max_upload_size())));
    }
    // if
    return '<div class="attach_files" id="' . $id . '" max_files="' . $max_files . '"><p class="attach_files_max_size details">' . $max_upload_size_message . '</p></div><script type="text/javascript">App.resources.AttachFiles.init("' . $id . '")</script>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:33,代码来源:function.attach_files.php

示例12: get_custom_properties

 function get_custom_properties()
 {
     $object_type = array_var($_GET, 'object_type');
     if ($object_type) {
         $cp = CustomProperties::getAllCustomPropertiesByObjectType($object_type);
         $customProperties = array();
         foreach ($cp as $custom) {
             $prop = array();
             $prop['id'] = $custom->getId();
             $prop['name'] = $custom->getName();
             $prop['object_type'] = $custom->getObjectTypeId();
             $prop['description'] = $custom->getDescription();
             $prop['type'] = $custom->getType();
             $prop['values'] = $custom->getValues();
             $prop['default_value'] = $custom->getDefaultValue();
             $prop['required'] = $custom->getIsRequired();
             $prop['multiple_values'] = $custom->getIsMultipleValues();
             $prop['visible_by_default'] = $custom->getVisibleByDefault();
             $prop['co_types'] = '';
             //CustomPropertiesByCoType::instance()->getCoTypesIdsForCpCSV($custom->getId());
             $customProperties[] = $prop;
         }
         ajx_current("empty");
         ajx_extra_data(array("custom_properties" => $customProperties));
     }
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:26,代码来源:PropertyController.class.php

示例13: smarty_function_join

/**
 * Join items
 * 
 * array('Peter', 'Joe', 'Adam') will be join like:
 * 
 * 'Peter, Joe and Adam
 * 
 * where separators can be defined as paremeters.
 * 
 * Parements:
 * 
 * - items - array of items that need to be join
 * - separator - used to separate all elements except the last one. ', ' by 
 *   default
 * - final_separator - used to separate last element from the rest of the 
 *   string. ' and ' by default
 *
 * @param array $params
 * @return string
 */
function smarty_function_join($params, &$smarty)
{
    $items = array_var($params, 'items');
    $separator = array_var($params, 'separator', ', ');
    $final_separator = array_var($params, 'final_separator', lang(' and '));
    if (is_foreachable($items)) {
        $result = '';
        $items_count = count($items);
        $counter = 0;
        foreach ($items as $item) {
            $counter++;
            if ($counter < $items_count - 1) {
                $result .= $item . $separator;
            } elseif ($counter == $items_count - 1) {
                $result .= $item . $final_separator;
            } else {
                $result .= $item;
            }
            // if
        }
        // if
        return $result;
    } else {
        return $items;
    }
    // if
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:47,代码来源:function.join.php

示例14: smarty_function_set_assignee_actionrequest_html

/**
 * Render inline select assignees
 * 
 * Parameters:
 * 
 * - ticket_id
 * - user_id
 * - name
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_set_assignee_actionrequest_html($params, &$smarty)
{
    $object_id = array_var($params, 'object_id');
    $user_id = array_var($params, 'user_id');
    $flag_set = false;
    $priority = -99;
    $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
    mysql_select_db(DB_NAME);
    $query = "select flag_actionrequest, priority_actionrequest from healingcrystals_assignments_flag_fyi_actionrequest where user_id='" . $user_id . "' and object_id='" . $object_id . "'";
    $result = mysql_query($query, $link);
    if (mysql_num_rows($result)) {
        $info = mysql_fetch_assoc($result);
        if ($info['flag_actionrequest'] == '1') {
            $flag_set = true;
        }
        $priority = $info['priority_actionrequest'];
    }
    mysql_close($link);
    $resp = '&nbsp;<input type="checkbox" name="assignee[flag_actionrequest][]" value="' . $user_id . '" class="input_checkbox" ' . ($flag_set ? ' checked="true" ' : '') . '  onclick="auto_select_checkboxes(this);" />
			 <select name="assignee[priority_actionrequest][]" onchange="auto_select_checkboxes(this);" style="display:none;">
			 	<option value="' . $user_id . '_-99"' . (is_null($priority) || $priority == '-99' ? ' selected ' : '') . '>-- Set Priority --</option>
			 	<option value="' . $user_id . '_' . PRIORITY_HIGHEST . '" ' . ($priority == PRIORITY_HIGHEST ? ' selected ' : '') . '>Highest Priority</option>
			 	<option value="' . $user_id . '_' . PRIORITY_HIGH . '" ' . ($priority == PRIORITY_HIGH ? ' selected ' : '') . '>High Priority</option>
			 	<option value="' . $user_id . '_' . PRIORITY_NORMAL . '" ' . ($priority == PRIORITY_NORMAL ? ' selected ' : '') . '>Normal Priority</option>
			 	<option value="' . $user_id . '_' . PRIORITY_LOW . '" ' . ($priority == PRIORITY_LOW ? ' selected ' : '') . '>Low Priority</option>
			 	<option value="' . $user_id . '_' . PRIORITY_LOWEST . '" ' . ($priority == PRIORITY_LOWEST ? ' selected ' : '') . '>Lowest Priority</option>
			 </select>';
    return $resp;
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:41,代码来源:function.set_assignee_actionrequest_html.php

示例15: smarty_function_select_project_object

/**
 * Render select parent object for provided project
 * 
 * Supported paramteres:
 * 
 * - types - type of of parent objects to be listed
 * - project - Instance of selected project (required)
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_select_project_object($params, &$smarty)
{
    $project = array_var($params, 'project');
    if (!instance_of($project, 'Project')) {
        return new InvalidParamError('project', $project, '$project is expected to be an instance of Project class', true);
    }
    // if
    $value = array_var($params, 'value');
    unset($params['project']);
    $types = array_var($params, 'types', null);
    if (!$types || !is_foreachable($types = explode(',', $types))) {
        $types = array('ticket', 'file', 'discussion', 'page');
    }
    // if
    $id_name_map = ProjectObjects::getIdNameMapForProject($project, $types);
    if (!is_foreachable($id_name_map)) {
        return false;
    }
    // if
    $sorted = array();
    foreach ($id_name_map as $object) {
        $option_attributes = $value == $object['id'] ? array('selected' => true) : null;
        $sorted[strtolower($object['type'])][] = option_tag($object['name'], $object['id'], $option_attributes);
    }
    // foreach
    if (is_foreachable($sorted)) {
        foreach ($sorted as $sorted_key => $sorted_values) {
            $options[] = option_group_tag($sorted_key, $sorted_values);
        }
        // foreach
    }
    // if
    return select_box($options, $params);
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:46,代码来源:function.select_project_object.php


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