/** * Add new activity into stream * @param array|object $data * @return CActivity|boolean */ public static function add($data) { $activity = new CActivity($data); /** * @todo We'll move all event trigger into this class not in table class or anywhere * @todo Anything else we want to include when posting please put here */ /* Event trigger */ $appsLib = CAppPlugins::getInstance(); $appsLib->loadApplications(); $params = array(); $params[] =& $activity; /* We do raise event here that will allow user change $activity properties before save it */ $appsLib->triggerEvent('onBeforeActivitySave', $params); if ($activity->get('cmd')) { /* Userpoints */ $userPointModel = CFactory::getModel('Userpoints'); $point = $userPointModel->getPointData($activity->get('cmd')); if ($point) { /** * @todo Need clearly about this ! * for every unpublished user points the stream will be disabled for that item * but not sure if this for 3rd party API, this feature should be available or not? */ if (!$point->published) { //return; } } } if ($activity->save()) { $params = array(); $params[] =& $activity; $appsLib->triggerEvent('onAfterActivitySave', $params); return $activity; } return false; }
* @url https://www.jomsocial.com/license-agreement * The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0 * More info at https://www.jomsocial.com/license-agreement */ defined('_JEXEC') or die; /** * @since 3.2 we'll use CActivity for each activity object * @todo in sprint 3 we must move everything into CActivity while passing into template layout */ /* Temporary fix for sprint 2 */ if ($this->act instanceof CTableActivity) { /* If this's CTableActivity then we use getProperties() */ $activity = new CActivity($this->act->getProperties()); } else { /* If it's standard object than we just passing it */ $activity = new CActivity($this->act); } $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $isSingleAct = $jinput->get->get('actid', 0) > 0 ? true : false; $address = $activity->getLocation(); $user = $activity->getActor(); $target = $activity->getTarget(); $headMetas = $activity->getParams('headMetas'); /* We do convert into JRegistry to make it easier to use */ if ($headMetas) { $headMetaParams = new JRegistry($headMetas); } if ($act->app == 'profile.avatar.upload') { if ($my->id > 0) { $this->load('activities.stream.options');
* @copyright (C) 2013 iJoomla, Inc. - All rights reserved. * @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html) * @author iJoomla.com <*****@*****.**> * @url https://www.jomsocial.com/license-agreement * The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0 * More info at https://www.jomsocial.com/license-agreement */ defined('_JEXEC') or die('Restricted access'); $user = CFactory::getUser($this->act->actor); /* Temporary fix since we not yet complete move to CActivity */ if ($this->act instanceof CTableActivity) { /* If this's CTableActivity then we use getProperties() */ $activity = new CActivity($this->act->getProperties()); } else { /* If it's standard object than we just passing it */ $activity = new CActivity($this->act); } $format = $config->get('eventshowampm') ? JText::_('COM_COMMUNITY_DATE_FORMAT_LC2_12H') : JText::_('COM_COMMUNITY_DATE_FORMAT_LC2_24H'); $browser = $_SERVER['HTTP_USER_AGENT']; $truncateVal = 60; if (preg_match('/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i', $browser) || preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i', substr($browser, 0, 4))) { $truncateVal = 30; } ?> <!-- Avatar --> <div class="joms-stream-avatar"> <?php if ($user->id > 0) { ?> <a href="<?php
$stream->attachments = array(); $stream->access = $video->permissions; $stream->createdtime = $createdTime; $quoteContent = CActivities::format($act->title, $mood); if (!empty($quoteContent) && $param->get('style') == COMMUNITY_STREAM_STYLE) { $attachment = new stdClass(); $attachment->type = 'text'; $attachment->message = $quoteContent; $attachment->hasMood = is_null($mood) ? false : true; /* Temporary fix for sprint 2 */ if ($this->act instanceof CTableActivity) { /* If this's CTableActivity then we use getProperties() */ $activity = new CActivity($this->act->getProperties()); } else { /* If it's standard object than we just passing it */ $activity = new CActivity($this->act); } $attachment->activity = $activity; $attachment->address = $activity->getLocation(); $stream->attachments[] = $attachment; } $attachment = new stdClass(); $attachment->type = 'video'; $attachment->id = $act->cid; $attachment->title = $video->title; $attachment->thumbnail = $video->getThumbnail(); $attachment->description = $video->description; $attachment->duration = CVideosHelper::toNiceHMS(CVideosHelper::formatDuration($video->getDuration())); $attachment->access = $act->access; $attachment->video_type = $video->type; $attachment->link = $video->path;
<?php /** * @copyright (C) 2013 iJoomla, Inc. - All rights reserved. * @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html) * @author iJoomla.com <*****@*****.**> * @url https://www.jomsocial.com/license-agreement * The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0 * More info at https://www.jomsocial.com/license-agreement */ defined('_JEXEC') or die; $activity = new CActivity($act); $permission = $activity->getPermission($my->id); $allowPrivacy = true; if (!CActivitiesHelper::getStreamPermission($act->actor)) { $allowPrivacy = false; } else { if ($act->app === 'albums.comment' || $act->app === 'photos.comment' || $act->app === 'videos.comment' || $act->app === 'cover.upload' || $act->app === 'groups.discussion.reply' || $act->app === 'groups.discussion' || strpos($act->app, 'like') !== false || strpos($act->app, 'system') !== false || strpos($act->app, 'groups.') !== false || strpos($act->app, 'events.') !== false) { $allowPrivacy = false; } } ?> <div class="joms-list__options"> <?php if ($permission->showButton || $my->id == 0 && CFactory::getConfig()->get('enableguestreporting')) { ?> <a href="javascript:" class="joms-button--options" data-ui-object="joms-dropdown-button"> <svg viewBox="0 0 16 16" class="joms-icon"> <use xlink:href="#joms-icon-arrow-down"></use>
public function ajaxShowStreamVideoWindow($activity_id) { $objResponse = new JAXResponse(); $my = CFactory::getUser(); $allowToView = true; if ($activity_id == '') { $allowToView = false; } $activityTable = JTable::getInstance('Activity', 'CTable'); if (!$activityTable->load($activity_id)) { $allowToView = false; } /* === Start Premission Checking === */ $user = CFactory::getUser($activityTable->actor); $blocked = $user->isBlocked(); if ($blocked && !COwnerHelper::isCommunityAdmin()) { $allowToView = false; } $activity = new CActivity($activityTable); $headMetas = $activity->getParams('headMetas'); $headMetaParams = ''; /* We do convert into JRegistry to make it easier to use */ if ($headMetas) { $headMetaParams = new JRegistry($headMetas); } $providerName = JString::strtolower($headMetaParams->get('video_provider')); if ($headMetaParams->get('type') == 'video' && $providerName != '') { $libraryPath = COMMUNITY_COM_PATH . '/libraries/videos' . '/' . $providerName . '.php'; require_once $libraryPath; $className = 'CTableVideo' . JString::ucfirst($providerName); $provider = new $className(); } if (!CPrivacy::isAccessAllowed($my->id, $activityTable->actor, 'custom', $activityTable->access)) { switch ($activityTable->access) { case '40': $allowToView = false; break; case '30': $allowToView = false; break; default: $allowToView = false; break; } } $objResponse->addScriptCall('cWindowShow', '', '', 640, 360); if ($allowToView) { $objResponse->addScriptCall('cWindowAddContent', $provider->getViewHTML($headMetaParams->get('video_id'), 640, 360)); } else { $objResponse->addScriptCall('cWindowAddContent', JText::_('COM_COMMUNITY_VIDEO_UNABLE_VIEW')); } $objResponse->sendResponse(); }
* @url https://www.jomsocial.com/license-agreement * The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0 * More info at https://www.jomsocial.com/license-agreement */ defined('_JEXEC') or die; /** * @since 3.2 we'll use CActivity for each activity object * @todo in sprint 3 we must move everything into CActivity while passing into template layout */ /* Temporary fix for sprint 2 */ if ($this->act instanceof CTableActivity) { /* If this's CTableActivity then we use getProperties() */ $activity = new CActivity($this->act->getProperties()); } else { /* If it's standard object than we just passing it */ $activity = new CActivity($this->act); } $address = $activity->getLocation(); $user = $activity->getActor(); $target = $activity->getTarget(); $headMetas = $activity->getParams('headMetas'); /* We do convert into JRegistry to make it easier to use */ if ($headMetas) { $headMetaParams = new JRegistry($headMetas); } if ($act->app == 'profile.avatar.upload') { $this->load('activities.profile.avatar.upload'); return; } if (!empty($act->params)) { if (!is_object($act->params)) {
/** * Update or save all timesheet's activities * @param int $userId * @param array $dataActivities * @param int $timesheetId * @param array $projectLeaderTasksIdList (optionnal) * @return bool */ public static function saveActivities($userId, $dataActivities, $timesheetId) { $q = new DBQuery(); $q->addTable('task_timesheet'); $q->addQuery('task_id'); $q->addWhere('timesheet_id =' . $timesheetId); $q->addWhere('status = 0'); //die($q->prepare()); $psql = $q->prepare(); $q->clear(); $taskIdRows = db_exec($psql); $validatedTaskId = array(); while ($row = db_fetch_assoc($taskIdRows)) { array_push($validatedTaskId, $row['task_id']); } //create activities where duration > 0 foreach ($dataActivities as $dataActivity) { $dataActivityArray = explode('|', $dataActivity); /* $dataActivityArray[1]: TaskId $dataActivityArray[2]; date */ $activity = new CActivity(); $activity->setDuration($dataActivityArray[0]); $activity->setTaskId($dataActivityArray[1]); $activity->setADate($dataActivityArray[2]); $activity->setUserId($userId); $activity->setTimesheetId($timesheetId); //check if the task isn't already validate if (!in_array($dataActivityArray[1], $validatedTaskId)) { //if the activity exist if ($activity->loadActivityId()) { $activity->update(); } else { if ($dataActivityArray[0] > 0) { $activity->save(); } } } } return true; }