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


PHP instance_of函数代码示例

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


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

示例1: invoicing_handle_on_object_deleted

/**
 * on_object_deleted handler implemenation
 *
 * @param AngieObject $object
 * @return null
 */
function invoicing_handle_on_object_deleted($object)
{
    if (instance_of($object, 'TimeRecord')) {
        db_execute('DELETE FROM ' . TABLE_PREFIX . 'invoice_time_records WHERE time_record_id = ?', $object->getId());
    }
    // if
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:13,代码来源:on_object_deleted.php

示例2: smarty_function_object_tasks

/**
 * Render object tasks section
 * 
 * Parameters:
 * 
 * - object - Selected project object
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_object_tasks($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
    $open_tasks = $object->getOpenTasks();
    if (is_foreachable($open_tasks)) {
        foreach ($open_tasks as $open_task) {
            ProjectObjectViews::log($open_task, $smarty->get_template_vars('logged_user'));
        }
        // foreach
    }
    // if
    $completed_tasks = $object->getCompletedTasks(COMPLETED_TASKS_PER_OBJECT);
    if (is_foreachable($completed_tasks)) {
        foreach ($completed_tasks as $completed_task) {
            ProjectObjectViews::log($completed_task, $smarty->get_template_vars('logged_user'));
        }
        // foreach
    }
    // if
    $smarty->assign(array('_object_tasks_object' => $object, '_object_tasks_open' => $open_tasks, '_object_tasks_can_reorder' => (int) $object->canEdit($smarty->get_template_vars('logged_user')), '_object_tasks_completed' => $completed_tasks, '_object_tasks_completed_remaining' => $object->countCompletedTasks() - COMPLETED_TASKS_PER_OBJECT, '_object_tasks_skip_wrapper' => array_var($params, 'skip_wrapper', false), '_object_tasks_skip_head' => array_var($params, 'skip_head', false), '_object_tasks_force_show' => array_var($params, 'force_show', true)));
    return $smarty->fetch(get_template_path('_object_tasks', 'tasks', RESOURCES_MODULE));
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:37,代码来源:function.object_tasks.php

示例3: smarty_function_select_default_assignment_filter

/**
 * Render select_default_assignment_filter control
 * 
 * Parameters:
 * 
 * - user - User - User using the page
 * - value - integer - ID of selected filter
 * - optional - boolean - Value is optional?
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_select_default_assignment_filter($params, &$smarty)
{
    $user = array_var($params, 'user', null, true);
    $value = array_var($params, 'value', null, true);
    $optional = array_var($params, 'optional', true, true);
    $default_filter_id = (int) ConfigOptions::getValue('default_assignments_filter');
    $default_filter = $default_filter_id ? AssignmentFilters::findById($default_filter_id) : null;
    $options = array();
    if (instance_of($default_filter, 'AssignmentFilter') && $optional) {
        $options[] = option_tag(lang('-- System Default (:filter) --', array('filter' => $default_filter->getName())), '');
    }
    // if
    $grouped_filters = AssignmentFilters::findGrouped($user, true);
    if (is_foreachable($grouped_filters)) {
        foreach ($grouped_filters as $group_name => $filters) {
            $group_options = array();
            foreach ($filters as $filter) {
                $group_options[] = option_tag($filter->getName(), $filter->getId(), array('selected' => $value == $filter->getId()));
            }
            // foreach
            if (count($options) > 0) {
                $options[] = option_tag('', '');
            }
            // if
            $options[] = option_group_tag($group_name, $group_options);
        }
        // foreach
    }
    // if
    return select_box($options, $params);
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:44,代码来源:function.select_default_assignment_filter.php

示例4: smarty_function_object_recurring_period

/**
 * Render object reminder information
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_object_recurring_period($params, &$smarty)
{
    $ticket = array_var($params, 'object');
    if (!instance_of($ticket, 'Ticket')) {
        return 'N/A';
    }
    // if
    $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
    mysql_select_db(DB_NAME);
    $query = "select * from healingcrystals_project_object_misc where object_id='" . (int) $ticket->getId() . "'";
    $result = mysql_query($query, $link);
    if (mysql_num_rows($result)) {
        $info = mysql_fetch_assoc($result);
        $reminder_date = $info['reminder_date'];
        $recurring_period = $info['recurring_period'];
        $recurring_period_type = $info['recurring_period_type'];
    }
    mysql_close($link);
    $resp = '<form name="frmRecurringPeriod" action="' . $ticket->getEditUrl() . '&mode=recurring_period_update_mode" method=post>
                    <input type="text" name="recurring_period" value="' . $recurring_period . '" maxlength="5" style="width:50px;" onchange="this.form.submit();" />&nbsp;
                    <select name="recurring_period_type" style="width:80px;" onchange="this.form.submit();">
                        <option value="D" ' . ($recurring_period_type == 'D' ? ' selected ' : '') . '>Days</option>
			<option value="W" ' . ($recurring_period_type == 'W' ? ' selected ' : '') . '>Weeks</option>
			<option value="M" ' . ($recurring_period_type == 'M' ? ' selected ' : '') . '>Months</option>
			<option value="Y" ' . ($recurring_period_type == 'Y' ? ' selected ' : '') . '>Years</option>
                    </select>
		</form>';
    return $resp;
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:36,代码来源:function.object_recurring_period.php

示例5: 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

示例6: save

 /**
  * This function saves the wiki page 
  *
  * @return void
  */
 function save()
 {
     if (instance_of($this->new_revision, 'Revision')) {
         // Increase the page revision number
         $this->setColumnValue('revision', $this->getColumnValue('revision') + 1);
         // Remove any other pages in this project which have the default page status
         if ($this->isColumnModified('project_index') && $this->getColumnValue('project_index') == 1) {
             $sql = 'UPDATE ' . $this->getTableName(true) . ' SET `project_index` = 0 WHERE `project_id` = ' . $this->getProjectId();
             DB::execute($sql);
         }
         // Remove any other pages in this project which have sidebar status
         if ($this->isColumnModified('project_sidebar') && $this->getColumnValue('project_sidebar') == 1) {
             $sql = 'UPDATE ' . $this->getTableName(true) . ' SET `project_sidebar` = 0 WHERE `project_id` = ' . $this->getProjectId();
             DB::execute($sql);
         }
         // Save this page with the new revision id
         parent::save();
         // Set the revisions's page Id
         $this->new_revision->setPageId($this->getId());
         //Set the project Id
         $this->new_revision->setProjectId($this->getProjectId());
         // Set the revision number in the revision object
         $this->new_revision->setRevision($this->getColumnValue('revision'));
         // If we have made a new revision of this page, then save the revision
         $this->new_revision->save();
     } else {
         // We haven't made a new revision, so we shouldn't update this page
         return false;
     }
 }
开发者ID:bahmany,项目名称:PythonPurePaperless,代码行数:35,代码来源:BaseWikiPage.class.php

示例7: smarty_function_object_subscriptions

/**
 * Render object subscribers
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_object_subscriptions($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
    js_assign('max_subscribers_count', MAX_SUBSCRIBERS_COUNT);
    require_once SYSTEM_MODULE_PATH . '/helpers/function.user_link.php';
    $subscribers = $object->getSubscribers();
    if (count($subscribers) > MAX_SUBSCRIBERS_COUNT) {
        $smarty->assign(array('_object_subscriptions_list_subscribers' => false, '_object_subscriptions_object' => $object, '_object_subscriptions_subscribers_count' => count($subscribers), '_object_subscription_brief' => array_var($params, 'brief', false), '_object_subscriptions_popup_url' => assemble_url('object_subscribers_widget', array('object_id' => $object->getId()))));
    } else {
        $links = null;
        if (is_foreachable($subscribers)) {
            $links = array();
            foreach ($subscribers as $subscriber) {
                $links[] = smarty_function_user_link(array('user' => $subscriber), $smarty);
            }
            // foreach
        }
        // if
        $smarty->assign(array('_object_subscriptions_list_subscribers' => true, '_object_subscriptions' => $subscribers, '_object_subscriptions_object' => $object, '_object_subscription_links' => $links, '_object_subscription_brief' => array_var($params, 'brief', false), '_object_subscriptions_popup_url' => assemble_url('object_subscribers_widget', array('object_id' => $object->getId()))));
    }
    // if
    return $smarty->fetch(get_template_path('_object_subscriptions', 'subscriptions', RESOURCES_MODULE));
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:34,代码来源:function.object_subscriptions.php

示例8: smarty_function_object_visibility

/**
 * Show object visibility if it's private
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_object_visibility($params, &$smarty)
{
    static $ids = array();
    $object = array_var($params, 'object');
    if (!instance_of($object, 'ProjectObject')) {
        return new InvalidParamError('object', $object, '$object is not valid instance of ProjectObject class', true);
    }
    // if
    if ($object->getVisibility() > VISIBILITY_PRIVATE) {
        return '';
    }
    // if
    $user = array_var($params, 'user');
    if (!instance_of($user, 'User')) {
        return new InvalidParamError('user', $user, '$user is expected to be an instance of User class', true);
    }
    // if
    if (!$user->canSeePrivate()) {
        return '';
    }
    // if
    $id = array_var($params, 'id');
    if (empty($id)) {
        do {
            $id = 'object_visibility_' . make_string(40);
        } while (in_array($id, $ids));
    }
    // if
    $ids[] = $id;
    return open_html_tag('a', array('href' => assemble_url('project_object_visibility', array('project_id' => $object->getProjectId(), 'object_id' => $object->getId())), 'title' => lang('Private :type', array('type' => Inflector::humanize($object->getType()))), 'class' => 'object_visibility', 'id' => $id)) . '<img src="' . get_image_url('private.gif') . '" alt="" /></a><script type="text/javascript">App.widgets.ObjectVisibility.init("' . $id . '");</script>';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:38,代码来源:function.object_visibility.php

示例9: findGrouped

 /**
  * Return all filters grouped by group name
  *
  * @param User $user
  * @param boolean $skip_private
  * @return array
  */
 function findGrouped($user = null, $skip_private = false)
 {
     $result = null;
     $conditions = null;
     if (instance_of($user, 'User')) {
         $conditions = array('is_private = ? OR (is_private = ? AND created_by_id = ?)', false, true, $user->getId());
     } elseif ($skip_private) {
         $conditions = array('is_private = ?', false);
     }
     // if
     $all = AssignmentFilters::find(array('conditions' => $conditions, 'order' => 'group_name, name'));
     if (is_foreachable($all)) {
         $result = array();
         $other_filters = array();
         foreach ($all as $filter) {
             if ($group_name = $filter->getGroupName()) {
                 if (!isset($result[$group_name])) {
                     $result[$group_name] = array();
                 }
                 // if
                 $result[$group_name][] = $filter;
             } else {
                 $other_filters[] = $filter;
             }
             // if
         }
         // foreach
         if (count($other_filters)) {
             $result[lang('Other')] = $other_filters;
         }
     }
     // if
     return $result;
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:41,代码来源:AssignmentFilters.class.php

示例10: source_handle_on_object_deleted

/**
 * on_object_deleted handler implemenation
 *
 * @param AngieObject $object
 * @return null
 */
function source_handle_on_object_deleted($object)
{
    if (instance_of($object, 'Ticket') || instance_of($object, 'Discussion') || instance_of($object, 'Milestone') || instance_of($object, 'Task')) {
        db_execute('DELETE FROM ' . TABLE_PREFIX . 'commit_project_objects WHERE object_id = ? AND project_id = ?', $object->getId(), $object->getProjectId());
    }
    // if
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:13,代码来源:on_object_deleted.php

示例11: discussions_handle_on_portal_object_quick_options

/**
 * Populate quick portal object options
 *
 * @param NamedList $options
 * @param ProjectObject $object
 * @param Portal $portal
 * @param Commit $commit
 * @param string $file
 * @return null
 */
function discussions_handle_on_portal_object_quick_options(&$options, $object, $portal = null, $commit = null, $file = null)
{
    if (instance_of($object, 'Discussion')) {
        $options->beginWith('details', array('text' => lang('Toggle Details'), 'url' => '#'));
    }
    // if
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:17,代码来源:on_portal_object_quick_options.php

示例12: resources_handle_on_comment_deleted

/**
 * Handle on on_comment_deleted event
 *
 * @param Comment $comment
 * @param ProjectObject $parent
 * @return null
 */
function resources_handle_on_comment_deleted(&$comment, &$parent)
{
    if (instance_of($parent, 'ProjectObject')) {
        $parent->refreshCommentsCount();
    }
    // if
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:14,代码来源:on_comment_deleted.php

示例13: system_handle_on_before_object_insert

/**
 * Set created_ properties for a given object if not set
 *
 * @param DataObject $object
 * @return null
 */
function system_handle_on_before_object_insert($object)
{
    if ($object->fieldExists('created_on')) {
        if (!isset($object->values['created_on'])) {
            $object->setCreatedOn(new DateTimeValue());
        }
        // if
    }
    // if
    $user =& get_logged_user();
    if (!instance_of($user, 'User')) {
        return;
    }
    // if
    if ($object->fieldExists('created_by_id') && !isset($object->values['created_by_id'])) {
        $object->setCreatedById($user->getId());
    }
    // if
    if ($object->fieldExists('created_by_name') && !isset($object->values['created_by_name'])) {
        $object->setCreatedByName($user->getDisplayName());
    }
    // if
    if ($object->fieldExists('created_by_email') && !isset($object->values['created_by_email'])) {
        $object->setCreatedByEmail($user->getEmail());
    }
    // if
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:33,代码来源:on_before_object_insert.php

示例14: smarty_function_object_comments_all

/**
 * List object comments
 * 
 * Parameters:
 * 
 * - object - Parent object. It needs to be an instance of ProjectObject class
 * - comments - List of comments. It is optional. If it is missing comments 
 *   will be loaded by calling getCommetns() method of parent object
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_object_comments_all($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
    $logged_user = $smarty->get_template_vars('logged_user');
    if (!instance_of($logged_user, 'User')) {
        return '';
    }
    // if
    $visiblity = $logged_user->getVisibility();
    //    if ($object->canView($logged_user) && $object->getVisibility() == VISIBILITY_PRIVATE) {
    if ($object->canView($logged_user)) {
        $visiblity = VISIBILITY_PRIVATE;
    }
    $comments = $object->getComments($visiblity);
    if (is_foreachable($comments)) {
        foreach ($comments as $comment) {
            ProjectObjectViews::log($comment, $logged_user);
            //BOF:task_1260
            $comment->set_action_request_n_fyi_flag($logged_user);
            //EOF:task_1260
        }
        // foreach
    }
    // if
    $count_from = 0;
    $smarty->assign(array('_object_comments_object' => $object, '_object_comments_count_from' => $count_from, '_object_comments_comments' => $comments, '_total_comments' => sizeof($comments)));
    return $smarty->fetch(get_template_path('_object_comments_all', 'comments', RESOURCES_MODULE));
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:45,代码来源:function.object_comments_all.php

示例15: renderHead

 /**
  * Render log details
  *
  * @param TimeRecord $object
  * @param boolean $in_project
  * @return string
  */
 function renderHead($object = null, $in_project = false)
 {
     if ($object === null) {
         $object = $this->getObject();
     }
     // if
     if (instance_of($object, 'TimeRecord')) {
         $created_by = $this->getCreatedBy();
         $variables = array('user_name' => $created_by->getDisplayName(true), 'user_url' => $created_by->getViewUrl(), 'url' => $object->getViewUrl(), 'value' => $object->getValue(), 'status' => $object->isBillable() ? lang('billable') : lang('non-billable'));
         $parent = $object->getParent();
         if (instance_of($parent, 'ProjectObject')) {
             $variables['parent_name'] = $parent->getName();
             $variables['parent_type'] = $parent->getVerboseType(true);
             $variables['parent_url'] = $parent->getViewUrl();
         } else {
             $project = $object->getProject();
             $variables['parent_name'] = $project->getName();
             $variables['parent_type'] = lang('project');
             $variables['parent_url'] = $project->getOverviewUrl();
         }
         // if
         return $object->getValue() == 1 ? lang('<a href=":user_url">:user_name</a> logged <a href=":url">1 :status hour</a> for <a href=":parent_url">:parent_name</a> :parent_type', $variables) : lang('<a href=":user_url">:user_name</a> logged <a href=":url">:value :status hours</a> for <a href=":parent_url">:parent_name</a> :parent_type', $variables);
     }
     // if
     return '';
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:33,代码来源:TimeAddedActivityLog.class.php


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