/**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $model = $this->loadModel($id);
     $model->assignedTo = User::getUserLinks($model->assignedTo);
     $type = 'project';
     parent::view($model, $type);
 }
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $model = $this->loadModel($id);
     $model->assignedTo = User::getUserLinks($model->assignedTo);
     $model->associatedContacts = Contacts::getContactLinks($model->associatedContacts);
     $type = 'case';
     parent::view($model, $type);
 }
Example #3
0
 public function getOwner()
 {
     if (!empty($this->createdBy)) {
         $user = User::getUserLinks($this->createdBy, false, true);
         if (!empty($user)) {
             return $user;
         }
     }
     return ' ';
 }
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $userLinks = GroupToUser::model()->findAllByAttributes(array('groupId' => $id));
     $str = "";
     foreach ($userLinks as $userLink) {
         $str .= User::model()->findByPk($userLink->userId)->username . ", ";
     }
     $str = substr($str, 0, -2);
     $users = User::getUserLinks($str);
     $this->render('view', array('model' => $this->loadModel($id), 'users' => $users));
 }
Example #5
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $userLinks = GroupToUser::model()->findAllByAttributes(array('groupId' => $id));
     $str = "";
     foreach ($userLinks as $userLink) {
         $user = X2Model::model('User')->findByPk($userLink->userId);
         if (isset($user)) {
             $str .= $user->username . ", ";
         }
     }
     $str = substr($str, 0, -2);
     $users = User::getUserLinks($str);
     // add group to user's recent item list
     User::addRecentItem('g', $id, Yii::app()->user->getId());
     $this->render('view', array('model' => $this->loadModel($id), 'users' => $users));
 }
Example #6
0
 public function run()
 {
     x2base::cleanUpSessions();
     // $criteria = new CDbCriteria(array('condition'=>'','distinct'=>true)
     // $sessions = Session::model()->findAll($criteria);
     // $str = "";
     // foreach($sessions as $session) {
     // if(time()-$session->lastUpdated<(15*60)) {
     // $str.=$session->user.", ";
     // }
     // }
     // if($str!="") {
     // $str=substr($str,0,-2);
     // }
     $onlineUsers = User::getUserLinks(Session::getOnlineUsers());
     $this->render('onlineUsers', array('users' => $onlineUsers));
     //array(
 }
Example #7
0
    $relString = " | " . X2Model::getModelLink($data->associationId, X2Model::getModelName($data->associationType));
} else {
    $relString = "";
}
if (empty($data->type) || $data->type == 'weblead' || $data->type == 'workflow') {
    if ($data->complete == 'Yes') {
        echo Yii::t('actions', 'Completed by {name}', array('{name}' => User::getUserLinks($data->completedBy))) . $relString;
    } else {
        $userLink = User::getUserLinks($data->assignedTo);
        $userLink = empty($userLink) ? Yii::t('actions', 'Anyone') : $userLink;
        echo Yii::t('actions', 'Assigned to {name}', array('{name}' => $userLink)) . $relString;
    }
} else {
    if (in_array($data->type, array('note', 'call', 'emailOpened', 'time'))) {
        echo $data->completedBy == 'Guest' ? "Guest" : User::getUserLinks($data->completedBy) . $relString;
        // echo ' '.Formatter::formatDate($data->completeDate);
    } else {
        if ($data->type == 'attachment' && $data->completedBy != 'Email') {
            echo Yii::t('media', 'Uploaded by {name}', array('{name}' => User::getUserLinks($data->completedBy))) . $relString;
        } else {
            if (in_array($data->type, array('email', 'emailFrom')) && $data->completedBy != 'Email') {
                echo Yii::t('media', $data->type == 'email' ? 'Sent by {name}' : 'Sent to {name}', array('{name}' => User::getUserLinks($data->completedBy))) . $relString;
            }
        }
    }
}
?>
    </div>

</div>
Example #8
0
 public function getMessage()
 {
     if (empty($this->modelId) || empty($this->modelType)) {
         // skip if there is no association
         $record = null;
     } else {
         if (class_exists($this->modelType)) {
             $record = X2Model::model($this->modelType)->findByPk($this->modelId);
         } else {
             return 'Error: unknown record <b>' . $this->modelType . '</b>';
         }
         if ($record === null) {
             $this->delete();
             return null;
         }
     }
     if (!isset($record) && $this->type !== 'lead_failure' && $this->type !== 'custom') {
         // return var_dump($this->attributes);
         return null;
     }
     $passive = $this->createdBy === 'API' || empty($this->createdBy);
     switch ($this->type) {
         case 'action_complete':
             if ($passive) {
                 return Yii::t('actions', 'Action completed: {action}', array('{action}' => $record->getLink()));
             } else {
                 return Yii::t('actions', '{user} completed an action: {action}', array('{user}' => User::getUserLinks($record->completedBy), '{action}' => $record->getLink(20)));
             }
         case 'action_reminder':
             return Yii::t('actions', '<b>Reminder!</b> The following action is due: {action}', array('{action}' => $record->getLink()));
             // case 'workflow_complete':
             // if($passive)
             // return Yii::t('actions','Stage {n}: {stage} was completed for {record}',array('{record}'=>$record->getLink()));
             // else
             // return Yii::t('actions','{user} completed stage {n}: {stage} was completed for {record}',array('{record}'=>$record->getLink()));
         // case 'workflow_complete':
         // if($passive)
         // return Yii::t('actions','Stage {n}: {stage} was completed for {record}',array('{record}'=>$record->getLink()));
         // else
         // return Yii::t('actions','{user} completed stage {n}: {stage} was completed for {record}',array('{record}'=>$record->getLink()));
         case 'create':
             return Yii::t('app', 'New record assigned to you: {link}.', array('{link}' => $record->getLink()));
         case 'change':
             if ($this->comparison == 'change') {
                 $msg = $passive ? '{record}\'s {field} was changed to {value}' : '{user} changed {record}\'s {field} to {value}';
                 return Yii::t('app', $msg, array('{field}' => $record->getAttributeLabel($this->fieldName), '{value}' => $record->renderAttribute($this->fieldName, true, true), '{record}' => $record->getLink(), '{user}' => Yii::app()->user->getName() == $this->createdBy ? CHtml::link('You', array('/profile/view', 'id' => Yii::app()->user->getId())) : User::getUserLinks($this->createdBy)));
             } else {
                 // > < =
                 $msg = $passive ? '{record}\'s {field} was changed to {value}' : '{user} changed {record}\'s {field} to {value}';
                 return Yii::t('app', $msg, array('{field}' => $record->getAttributeLabel($this->fieldName), '{value}' => $record->renderAttribute($this->fieldName, true, true), '{record}' => $record->getLink(), '{user}' => Yii::app()->user->getName() == $this->createdBy ? CHtml::link('You', array('/profile/view', 'id' => Yii::app()->user->getId())) : User::getUserLinks($this->createdBy)));
             }
         case 'lead_failure':
             return Yii::t('app', 'A lead failed to come through Lead Capture. Check {link} to recover it.', array('{link}' => CHtml::link(Yii::t('app', 'here'), Yii::app()->controller->createUrl('/contacts/contacts/cleanFailedLeads'))));
         case 'assignment':
             if ($passive) {
                 return Yii::t('app', 'You have been assigned a record: {record}', array('{record}' => $record->getLink()));
             } else {
                 return Yii::t('app', '{user} assigned a record to you: {record}', array('{user}' => User::getUserLinks($this->createdBy), '{record}' => $record->getLink()));
             }
         case 'delete':
             if ($passive) {
                 return Yii::t('app', 'Record deleted: {record}', array('{record}' => $this->modelType . ' ' . $this->modelId));
             } else {
                 return Yii::t('app', '{user} deleted a record: {record}', array('{user}' => User::getUserLinks($this->createdBy), '{record}' => $this->modelType . ' ' . $this->modelId));
             }
         case 'event_broadcast':
             return Yii::t('app', '{user} broadcast an event: {event}', array('{user}' => User::getUserLinks($record->user), '{event}' => $record->getText()));
         case 'update':
             if ($passive) {
                 return Yii::t('app', 'Record updated: {record}', array('{record}' => $record->getLink()));
             } else {
                 return Yii::t('app', '{user} updated a record: {record}', array('{user}' => User::getUserLinks($this->createdBy), '{record}' => $record->getLink()));
             }
         case 'dup_discard':
             if ($passive) {
                 return Yii::t('app', 'A record has been marked as a duplicate and hidden to everyone but the admin: {record}', array('{record}' => $record->getLink()));
             } else {
                 return Yii::t('app', '{user} marked a record as a duplicate. This record is hidden to everyone but the admin: {record}', array('{user}' => User::getUserLinks($this->createdBy), '{record}' => $record->getLink()));
             }
         case 'email_clicked':
             return Yii::t('app', '{record} clicked an email link: {campaign}', array('{record}' => $record->getLink(), '{campaign}' => $this->value));
         case 'email_opened':
             return Yii::t('app', '{record} opened an email: {campaign}', array('{record}' => $record->getLink(), '{campaign}' => $this->value));
         case 'email_unsubscribed':
             return Yii::t('app', '{record} unsubscribed from a campaign: {campaign}', array('{record}' => $record->getLink(), '{campaign}' => $this->value));
         case 'social_post':
             return Yii::t('app', '{user} posted on {link}', array('{user}' => User::getUserLinks($this->createdBy), '{link}' => $record->getLink()));
         case 'social_comment':
             return Yii::t('app', '{user} replied on {link}', array('{user}' => User::getUserLinks($this->createdBy), '{link}' => $record->getLink()));
         case 'voip_call':
             return Yii::t('app', 'Incoming call from <b>{phone}</b> ({record}) {time}', array('{record}' => $record->getLink(), '{phone}' => $this->value, '{time}' => Formatter::formatDateDynamic($this->createDate)));
         case 'weblead':
             return Yii::t('app', 'New web lead: {link}.', array('{link}' => $record->getLink()));
         case 'webactivity':
             if ($record instanceof Actions) {
                 if ($link = $record->getAssociationLink()) {
                     return Yii::t('app', '{name} is currently on {url}', array('{name}' => $link, '{url}' => $record->actionDescription));
                 }
             } elseif ($record instanceof Contacts) {
                 return Yii::t('app', '{name} is currently on your website.', array('{name}' => $record->getLink()));
             }
             return null;
         case 'escalateCase':
             return Yii::t('app', '{user} escalated a Service Case to you: {record}', array('{user}' => User::getUserLinks($this->createdBy), '{record}' => $record->createLink()));
         case 'custom':
             return $this->text;
         default:
             return 'Error: unknown type <b>' . $this->type . '</b>';
     }
 }
Example #9
0
            <?php 
echo $data->getLink();
?>
        </div>
        <div class="topic-attributes">
            <div class="topic-reply-count">
                <?php 
echo $data->renderAttribute('replyCount');
?>
            </div>
            <div class="topic-last-updated">
                <div class='avatar-container'>
                <?php 
echo Profile::renderFullSizeAvatar($data->lastPost->getAuthorId(), 30);
?>
                </div>
                <div class="topic-last-updated-text">
                    <?php 
echo User::getUserLinks($data->lastPost->updatedBy);
?>
<br>
                    <?php 
echo Formatter::formatDateTime($data->lastPost->createDate);
?>
                </div>
            </div>
        </div>
    </div>
</div>

Example #10
0
 }
 echo '<div class="formItem ' . $labelClass . '">';
 //echo '<div id="'.$modelName.'_'.$fieldName.'_inputBox" class="formItem '.$labelClass.'">';
 echo CHtml::label($model->getAttributeLabel($field->fieldName), false);
 $style = 'width:' . $item['width'] . 'px;';
 if ($field->type == 'text') {
     $style .= 'min-height:' . $item['height'] . 'px;';
 }
 echo '<div class="formInputBox" style="' . $style . '">';
 if ($field->type == 'date') {
     echo !empty($model->{$fieldName}) ? $this->formatLongDate($model->{$fieldName}) . ' ' : " ";
 } elseif ($field->type == 'rating') {
     $this->widget('CStarRating', array('model' => $model, 'attribute' => $field->fieldName, 'readOnly' => true, 'minRating' => 1, 'maxRating' => 5, 'starCount' => 5, 'cssFile' => Yii::app()->theme->getBaseUrl() . '/css/rating/jquery.rating.css'));
     echo '&nbsp;';
 } elseif ($field->type == 'assignment') {
     echo empty($model->{$fieldName}) ? "&nbsp;" : User::getUserLinks($model->{$fieldName});
 } elseif ($field->type == 'visibility') {
     switch ($model->{$fieldName}) {
         case '1':
             echo Yii::t('app', 'Public');
             break;
         case '0':
             echo Yii::t('app', 'Private');
             break;
         case '2':
             echo Yii::t('app', 'User\'s Groups');
             break;
         default:
             echo '&nbsp;';
     }
 } elseif ($field->type == 'email') {
Example #11
0
    public static function generateFeedEmail($filters, $userId, $range, $limit, $eventId, $deleteKey)
    {
        $image = Yii::app()->getAbsoluteBaseUrl(true) . '/images/x2engine.png';
        $msg = "<div id='wrap' style='width:6.5in;height:9in;margin-top:auto;margin-left:auto;margin-bottom:auto;margin-right:auto;'><html><body><center>";
        $msg .= '<table border="0" cellpadding="0" cellspacing="0" height="100%" id="top-activity" style="background: white; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; font-weight: normal; font-style: normal; font-size: 14px; line-height: 1; color: #222222; position: relative; -webkit-font-smoothing: antialiased;background-color:#FAFAFA;height:25% !important; margin:0; padding:0; width:100% !important;" width="100%">' . "<tbody><tr><td align=\"center\" style=\"padding-top:20px;\" valign=\"top\">" . '<table border="0" cellpadding="0" cellspacing="0" id="templateContainer" style="border: 1px solid #DDDDDD;background-color:#FFFFFF;" width="600"><tbody>';
        $msg .= '<tr>
                    <td align="center" valign="top"><!-- // Begin Template Header \\ -->
			<table border="0" cellpadding="0" cellspacing="0" id="templateHeader" width="600">
                            <tbody>
				<tr>
                                    <td class="headerContent" style="color:#202020;font-weight:bold;line-height:100%;padding:0;text-align:center;vertical-align:middle;font-family: inherit;font-weight: normal;font-size: 14px;margin-bottom: 17px"><img id="headerImage campaign-icon" src="' . $image . '" style="border:0; height:auto; line-height:100%; outline:none; text-decoration:none;max-width:600px;" /></td>
                                </tr>
                                <tr>
                                    <td style="color:#202020;font-weight:bold;padding:5px;text-align:center;vertical-align:middle;font-family: inherit;font-weight: normal;font-size: 14px;"><h2>' . Yii::t('profile', 'Activity Feed Report') . '</h2></td>
                                </tr>
                            </tbody>
			</table>
                    <hr width="60%"></td><!-- // End Template Header \\ -->
		</tr>';
        $msg .= '<tr><td align="center" valign="top"><!-- // Begin Template Body \\ -->' . '<table border="0" cellpadding="0" cellspacing="0" id="templateBody" width="600"><tbody><tr>' . '<td valign="top"><!-- // Begin Module: Standard Content \\ -->' . '<table border="0" cellpadding="20" cellspacing="0" width="100%"><tbody>';
        $params = array();
        $userRecord = X2Model::model('Profile')->findByPk($userId);
        $params[':username'] = $userRecord->username;
        $parsedFilters = Events::parseFilters($filters, $params);
        $visibilityCondition = $parsedFilters['conditions']['visibility'];
        $accessCriteria = Events::model()->getAccessCriteria();
        $userCondition = $parsedFilters['conditions']['users'];
        $typeCondition = $parsedFilters['conditions']['types'];
        $subtypeCondition = $parsedFilters['conditions']['subtypes'];
        $condition = "type!='comment' AND (type!='action_reminder' " . "OR user=:username) AND " . "(type!='notif' OR user=:username)" . $visibilityCondition . $userCondition . $typeCondition . $subtypeCondition . ' AND (' . $accessCriteria->condition . ')';
        switch ($range) {
            case 'daily':
                $timeRange = 24 * 60 * 60;
                break;
            case 'weekly':
                $timeRange = 7 * 24 * 60 * 60;
                break;
            case 'monthly':
                $timeRange = 30 * 24 * 60 * 60;
                break;
            default:
                $timeRange = 24 * 60 * 60;
                break;
        }
        $condition .= " AND timestamp BETWEEN " . (time() - $timeRange) . " AND " . time();
        $topTypes = Yii::app()->db->createCommand()->select('type, COUNT(type)')->from('x2_events')->where($condition, array_merge($params, $accessCriteria->params))->group('type')->order('COUNT(type) DESC')->limit(5)->queryAll();
        $topUsers = Yii::app()->db->createCommand()->select('user, COUNT(user)')->from('x2_events')->where($condition, array_merge($params, $accessCriteria->params))->group('user')->order('COUNT(user) DESC')->limit(5)->queryAll();
        $msg .= "<tr><td style='text-align:center;'>";
        $msg .= "<div>" . Yii::t('profile', "Here's your {range} update on what's been going on in X2Engine!", array('{range}' => Yii::t('profile', $range))) . "</div><br>" . "<div>Time Range: <em>" . Formatter::formatDateTime(time() - $timeRange) . "</em> to <em>" . Formatter::formatDateTime(time()) . "</em></div>";
        $msg .= "</tr></td>";
        $msg .= "<tr><td><table width='100%'><tbody>";
        $msg .= "<tr><th>" . Yii::t('profile', "Top Activity") . "</th><th>" . Yii::t('profile', "Top Users") . "</th></tr>";
        for ($i = 0; $i < 5; $i++) {
            $msg .= "<tr><td style='text-align:center;'>";
            if (isset($topTypes[$i])) {
                $type = Events::parseType($topTypes[$i]['type']);
                $count = $topTypes[$i]['COUNT(type)'];
                $msg .= $count . " " . $type;
            }
            $msg .= "</td><td style='text-align:center;'>";
            if (isset($topUsers[$i]) && $topUsers[$i]['COUNT(user)'] > 0) {
                $username = User::getUserLinks($topUsers[$i]['user'], false, true);
                $count = $topUsers[$i]['COUNT(user)'];
                $msg .= $count . " " . Yii::t('profile', "events from") . " " . $username . ".";
            }
            $msg .= "</td></tr>";
        }
        $msg .= "</tbody></table></td></tr>";
        $msg .= "<tr><td style='text-align:center'><hr width='60%'>";
        $msg .= "<tr><td style='text-align:center;'>" . Yii::t('profile', "Here's the {limit} most recent items on the Activity Feed.", array('{limit}' => $limit)) . "</td></tr>";
        $msg .= "</td></tr>";
        $msg .= "<tr><td style='text-align:center'><hr width='60%'><table><tbody>";
        $events = new CActiveDataProvider('Events', array('criteria' => array('condition' => $condition, 'order' => 'timestamp DESC', 'params' => array_merge($params, $accessCriteria->params)), 'pagination' => array('pageSize' => $limit)));
        foreach ($events->getData() as $event) {
            $msg .= "<tr>";
            $avatar = Yii::app()->db->createCommand()->select('avatar')->from('x2_profile')->where('username=:user', array(':user' => $event->user))->queryScalar();
            if (!empty($avatar) && file_exists($avatar)) {
                $avatar = Yii::app()->getAbsoluteBaseUrl() . '/' . $avatar;
            } else {
                $avatar = Yii::app()->getAbsoluteBaseUrl(true) . '/uploads/default.png';
            }
            $typeFile = $event->type;
            if (in_array($event->type, array('email_sent', 'email_opened'))) {
                if (in_array($event->subtype, array('quote', 'invoice'))) {
                    $typeFile .= "_{$event->subtype}";
                }
            }
            if ($event->type == 'record_create') {
                switch ($event->subtype) {
                    case 'call':
                        $typeFile = 'voip_call';
                        break;
                    case 'time':
                        $typeFile = 'log_time';
                        break;
                }
            }
            $imgFile = $avatar;
            if (file_exists(Yii::app()->theme->getBasePath() . '/images/eventIcons/' . $typeFile . '.png')) {
                $imgFile = Yii::app()->getAbsoluteBaseUrl() . '/themes/' . Yii::app()->theme->getName() . '/images/eventIcons/' . $typeFile . '.png';
            }
            $img = CHtml::image($imgFile, '', array('style' => 'width:45px;height:45px;float:left;margin-right:5px;'));
            $msg .= "<td>" . $img . "</td>";
            $msg .= "<td style='text-align:left'><span class='event-text'>" . $event->getText(array('requireAbsoluteUrl' => true), array('style' => 'text-decoration:none;')) . "</span></td>";
            $msg .= "</tr>";
        }
        $msg .= "</tbody></table></td></tr>";
        $msg .= "<tr><td style='text-align:center'><hr width='60%'><table><tbody>";
        $msg .= Yii::t('profile', "To stop receiving this report, ") . CHtml::link(Yii::t('profile', 'click here'), Yii::app()->getAbsoluteBaseUrl() . '/index.php/profile/deleteActivityReport?id=' . $eventId . '&deleteKey=' . $deleteKey);
        $msg .= "</tbody></table></td></tr>";
        $msg .= '</tbody></table></td></tr></tbody></table></td></tr>';
        $msg .= "<tbody></table></td></tr></tbody></table></center></body></html></div>";
        return $msg;
    }
Example #12
0
		<td colspan="3">
			<?php 
        echo CHtml::link($model->associationName, array("/" . $model->associationType . "/default/view", "id" => $model->associationId));
        ?>
		</td>
	</tr>
	<tr>
<?php 
    }
    ?>
		<td class="label"><?php 
    echo $attributeLabels['assignedTo'];
    ?>
</td>
		<td><?php 
    echo $model->assignedTo == 'Anyone' ? $model->assignedTo : User::getUserLinks($model->assignedTo);
    ?>
</td>
		<td class="label" width="20%"><?php 
    echo $attributeLabels['dueDate'];
    ?>
		<td><b><?php 
    echo $this->formatLongDateTime($model->dueDate);
    ?>
</b></td>
	</tr>
	<tr>
		<td class="label"><?php 
    echo $attributeLabels['priority'];
    ?>
</td>
Example #13
0
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by X2Engine".
 *****************************************************************************************/
?>
<div class="view top-level">
	<div class="deleteButton">
		<?php 
$parent = Events::model()->findByPk($data->associationId);
if ($data->user == Yii::app()->user->getName() || $parent->associationId == Yii::app()->user->getId() || Yii::app()->params->isAdmin) {
    echo CHtml::link('', array('/profile/deletePost', 'id' => $data->id, 'profileId' => $profileId), array('class' => 'fa fa-close'));
}
//,array('class'=>'x2-button')
?>
	</div>
	<?php 
echo User::getUserLinks($data->user);
echo ' ';
echo X2Html::tag('span', array('class' => 'comment-age x2-hint', 'id' => "-{$data->timestamp}", 'title' => Formatter::formatFeedTimestamp($data->timestamp)), Formatter::formatFeedTimestamp($data->timestamp));
?>
 
	<br/>
	<?php 
echo $data->text;
?>
</div>


<?php 
/*
<div class="view">
	<div class="deleteButton">
Example #14
0
        </div>
        <div class='topic-text'>
            <div class='topic-timestamp-text'>
                <?php 
echo Yii::t('topics', 'Posted {datetime}.', array('{datetime}' => Formatter::formatDateTime($data->createDate, 'medium')));
?>
            </div>
            <br>
            <?php 
echo Formatter::convertLineBreaks(x2base::convertUrls($data->text));
?>
            <div class='topic-timestamp-text'>
                <br>
                <?php 
if ($data->isEdited()) {
    echo Yii::t('topics', 'Edited by {user} - {datetime}.', array('{user}' => User::getUserLinks($data->updatedBy, false, true), '{datetime}' => Formatter::formatDateTime($data->lastUpdated, 'medium')));
}
?>
            </div>
        </div>

    </div>
    <div class='topic-footer'>
            <?php 
if (count($data->attachments) > 0) {
    echo "<div class='topic-attachment-label'>";
    echo Yii::t('topics', 'Attachments');
    echo "</div>";
    echo "<div class='topic-attachment-list'>";
    foreach ($data->attachments as $media) {
        echo '<span class="x2-pillbox topic-attachment">' . $media->getMediaLink() . '</span>';
Example #15
0
 protected function renderOptionalAssignment($field, $makeLinks, $textOnly, $encode)
 {
     $fieldName = $field->fieldName;
     if ($this->owner->{$fieldName} == '') {
         return '';
     } else {
         return User::getUserLinks($this->owner->{$fieldName});
     }
 }
Example #16
0
 public function search()
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $criteria = new CDbCriteria();
     $fields = Fields::model()->findAllByAttributes(array('modelName' => 'Accounts'));
     foreach ($fields as $field) {
         $fieldName = $field->fieldName;
         switch ($field->type) {
             case 'boolean':
                 $criteria->compare($field->fieldName, $this->compareBoolean($this->{$fieldName}), true);
                 break;
             case 'link':
                 $criteria->compare($field->fieldName, $this->compareLookup($field, $this->{$fieldName}), true);
                 break;
             case 'assignment':
                 $criteria->compare($field->fieldName, $this->compareAssignment($this->{$fieldName}), true);
                 break;
             default:
                 $criteria->compare($field->fieldName, $this->{$fieldName}, true);
         }
     }
     $dataProvider = new SmartDataProvider(get_class($this), array('sort' => array('defaultOrder' => 'name ASC'), 'pagination' => array('pageSize' => ProfileChild::getResultsPerPage()), 'criteria' => $criteria));
     $arr = $dataProvider->getData();
     foreach ($arr as $account) {
         $account->assignedTo = User::getUserLinks($account->assignedTo);
         $account->associatedContacts = Contacts::getContactLinks($account->associatedContacts);
     }
     $dataProvider->setData($arr);
     return $dataProvider;
 }
Example #17
0
 /**
  * An AJAX called function which will return HTML containing a full history
  * of a particular session, from login to logout.
  * @param $id The ID of the session
  */
 public function actionViewSessionHistory($id)
 {
     $sessions = X2Model::model('SessionLog')->findAllByAttributes(array('sessionId' => $id));
     $firstTimestamp = 0;
     $lastTimestamp = 0;
     $str = "<table class='items'><thead><tr><th>User</th><th>Status</th><th>Timestamp</th></tr></thead>";
     foreach ($sessions as $session) {
         $str .= "<tr>";
         $str .= "<td>" . User::getUserLinks($session->user) . "</td>";
         $str .= "<td>" . SessionLog::parseStatus($session->status) . "</td>";
         $str .= "<td>" . Formatter::formatCompleteDate($session->timestamp) . "</td>";
         $str .= "</tr>";
     }
     $str .= "</table>";
     echo $str;
 }
Example #18
0
// convert LF and CRLF to <br />
?>
	</div>
	<div class="footer">
	<?php 
if (empty($data->type) || $data->type == 'workflow') {
    if ($data->complete == 'Yes') {
        echo Yii::t('actions', 'Completed by {name}', array('{name}' => User::getUserLinks($data->completedBy)));
    } else {
        $userLink = User::getUserLinks($data->assignedTo);
        $userLink = empty($userLink) ? Yii::t('actions', 'Anyone') : $userLink;
        echo Yii::t('actions', 'Assigned to {name}', array('{name}' => $userLink));
    }
} else {
    if ($data->type == 'note' || $data->type == 'call') {
        echo User::getUserLinks($data->completedBy);
        // echo ' '.Actions::formatDate($data->completeDate);
    } else {
        if ($data->type == 'attachment' && $data->completedBy != 'Email') {
            echo Yii::t('media', 'Uploaded by {name}', array('{name}' => User::getUserLinks($data->completedBy)));
        } else {
            if ($data->type == 'email' && $data->completedBy != 'Email') {
                echo Yii::t('media', 'Sent by {name}', array('{name}' => User::getUserLinks($data->completedBy)));
            }
        }
    }
}
?>
	</div>

</div>