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


PHP CContact::findContactByUserid方法代码示例

本文整理汇总了PHP中CContact::findContactByUserid方法的典型用法代码示例。如果您正苦于以下问题:PHP CContact::findContactByUserid方法的具体用法?PHP CContact::findContactByUserid怎么用?PHP CContact::findContactByUserid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CContact的用法示例。


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

示例1: addField

 public function addField($fieldName, $fieldValue)
 {
     if ('' == $fieldValue) {
         return '-';
     }
     $pieces = explode('_', $fieldName);
     $suffix = end($pieces);
     switch ($suffix) {
         case 'datetime':
             $myDate = intval($fieldValue) ? new w2p_Utilities_Date($this->AppUI->formatTZAwareTime($fieldValue, '%Y-%m-%d %T')) : null;
             $output = $myDate ? $myDate->format($this->dtf) : '-';
             break;
         case 'email':
             $output = w2p_email($fieldValue);
             break;
         case 'url':
             $value = str_replace(array('"', '"', '<', '>'), '', $fieldValue);
             $output = w2p_url($value);
             break;
         case 'owner':
             if (!$fieldValue) {
                 return '-';
             }
             $obj = new CContact();
             $obj->findContactByUserid($fieldValue);
             $link = '?m=users&a=view&user_id=' . $fieldValue;
             $output = '<a href="' . $link . '">' . $obj->contact_display_name . '</a>';
             break;
         case 'percent':
             $output = round($fieldValue) . '%';
             break;
         case 'description':
             $output = w2p_textarea($fieldValue);
             break;
         case 'company':
         case 'department':
         case 'project':
             $class = 'C' . ucfirst($suffix);
             $obj = new $class();
             $obj->load($fieldValue);
             $link = '?m=' . w2p_pluralize($suffix) . '&a=view&' . $suffix . '_id=' . $fieldValue;
             $output = '<a href="' . $link . '">' . $obj->{"{$suffix}" . '_name'} . '</a>';
             break;
         default:
             $output = htmlspecialchars($fieldValue, ENT_QUOTES);
     }
     return $output;
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:48,代码来源:ViewHelper.class.php

示例2: getOwner

 public function getOwner()
 {
     trigger_error("The CFile->getOwner method has been deprecated in v3.2 and will be removed in v5.0. Please use just load a CContact object instead", E_USER_NOTICE);
     $contact = new CContact();
     $contact->findContactByUserid((int) $this->file_owner);
     return $contact->contact_display_name;
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:7,代码来源:files.class.php

示例3: createCell

 /**
  * createColumn is handy because it can take any input $fieldName and use
  *   its suffix to determine how the field should be displayed.
  *
  * This allows us to treat project_description, task_description,
  *   company_description, or even some_other_crazy_wacky_description in
  *   exactly the same way without additional lines of code or configuration.
  *   If you want to do your own, feel free... but this is probably easier.
  * 
  * Examples: _budget, _date, _name, _owner
  * 
  * This may not work for things like company_type or project_type which are
  *   actually just references to look up tables, ... but should work on
  *   fields like project_company, dept_company because we still have a 
  *   common suffix.
  *
  * @note I'm kind of annoyed about the complexity and sheer number of
  *   paths of this method but overall I think it's laid out reasonably
  *   well. I think the more important part is that I've been able to
  *   encapsulate it all here instead of spreading it all over the modules
  *   and views.
  */
 public function createCell($fieldName, $value, $custom = array())
 {
     $additional = '';
     if ('' == $value) {
         return '<td>-</td>';
     }
     $pieces = explode('_', $fieldName);
     $prefix = $pieces[0];
     $suffix = '_' . end($pieces);
     if ($fieldName == 'project_actual_end_date') {
         $suffix = '_actual';
     }
     switch ($suffix) {
         //BEGIN: object-based linkings
         /*
          * TODO: The following cases are likely to change once we have an approach to 
          *   handle module-level objects and their proper mapping/linkings.
         */
         case '_company':
         case '_contact':
         case '_task':
             $module = substr($suffix, 1);
             $class = 'C' . ucfirst($module);
             $obj = new $class();
             $obj->load($value);
             $link = '?m=' . w2p_pluralize($module) . '&a=view&' . $module . '_id=' . $value;
             $cell = '<a href="' . $link . '">' . $obj->{"{$module}" . '_name'} . '</a>';
             $suffix .= ' _name';
             break;
         case '_department':
             $module = substr($suffix, 1);
             $class = 'C' . ucfirst($module);
             $obj = new $class();
             $obj->load($value);
             /**
              * This is a branch separate from _company, _contact, etc above because although the module is called
              *   departments, the fields are dept_id and dept_name. :(
              *                                                              ~ caseydk, Dec 11 2013
              */
             $link = '?m=' . w2p_pluralize($module) . '&a=view&dept_id=' . $value;
             $cell = '<a href="' . $link . '">' . $obj->dept_name . '</a>';
             $suffix .= ' _name';
             break;
         case '_folder':
             $obj = new CFile_Folder();
             $obj->load($value);
             $foldername = $value ? $obj->file_folder_name : 'Root';
             $image = '<img src="' . w2PfindImage('folder5_small.png', 'files') . '" />';
             $link = '?m=files&tab=4&folder=' . (int) $value;
             $cell = '<a href="' . $link . '">' . $image . ' ' . $foldername . '</a>';
             $suffix .= ' _name';
             break;
         case '_user':
         case '_username':
             $obj = new CContact();
             $obj->findContactByUserid($this->tableRowData['user_id']);
             $link = '?m=users&a=view&user_id=' . $this->tableRowData['user_id'];
             $cell = '<a href="' . $link . '">' . $obj->user_username . '</a>';
             break;
             //END: object-based linkings
             /*
              * TODO: These two prefix adjustments are an ugly hack because our departments 
              *   table doesn't follow the same convention as every other table we have. 
              *   This needs to be fixed in v4.0 - caseydk 13 Feb 2012
              *
              * TODO: And unfortunately, the forums module is screwy using 'viewer' instead 
              *   of our standard 'view' for the page. ~ caseydk 16 Feb 2012
             */
         //END: object-based linkings
         /*
          * TODO: These two prefix adjustments are an ugly hack because our departments 
          *   table doesn't follow the same convention as every other table we have. 
          *   This needs to be fixed in v4.0 - caseydk 13 Feb 2012
          *
          * TODO: And unfortunately, the forums module is screwy using 'viewer' instead 
          *   of our standard 'view' for the page. ~ caseydk 16 Feb 2012
         */
         case '_name':
//.........这里部分代码省略.........
开发者ID:illuminate3,项目名称:web2project,代码行数:101,代码来源:HTMLHelper.class.php

示例4: getTaskEmailLog

 public function getTaskEmailLog(CTask $task, CTask_Log $log)
 {
     $project = new CProject();
     $projname = $project->load($task->task_project)->project_name;
     $contact = new CContact();
     $creatorname = $contact->findContactByUserid($log->task_log_creator)->contact_display_name;
     $body = $this->_AppUI->_('Project', UI_OUTPUT_RAW) . ': ' . $projname . "\n";
     if ($task->task_parent != $task->task_id) {
         $tmpTask = new CTask();
         $taskname = $tmpTask->load($task->task_parent)->task_name;
         $body .= $this->_AppUI->_('Parent Task', UI_OUTPUT_RAW) . ': ' . $taskname . "\n";
     }
     $body .= $this->_AppUI->_('Task', UI_OUTPUT_RAW) . ': ' . $task->task_name . "\n";
     $task_types = w2PgetSysVal('TaskType');
     $body .= $this->_AppUI->_('Task Type', UI_OUTPUT_RAW) . ':' . $task_types[$task->task_type] . "\n";
     $body .= $this->_AppUI->_('URL', UI_OUTPUT_RAW) . ': ' . W2P_BASE_URL . '/index.php?m=tasks&a=view&task_id=' . $task->task_id . "\n\n";
     $body .= "------------------------\n\n";
     $body .= $this->_AppUI->_('User', UI_OUTPUT_RAW) . ': ' . $creatorname . "\n";
     $body .= $this->_AppUI->_('Hours', UI_OUTPUT_RAW) . ': ' . $log->task_log_hours . "\n";
     $body .= $this->_AppUI->_('Summary', UI_OUTPUT_RAW) . ': ' . $log->task_log_name . "\n\n";
     $body .= $log->task_log_description;
     $user = new CUser();
     $body .= "\n--\n" . $user->load($this->_AppUI->user_id)->user_signature;
     return $body;
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:25,代码来源:EmailManager.class.php


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