예제 #1
9
 public static function getAnnounceDirectory(Announcement $announce)
 {
     $directory = $_SERVER['DOCUMENT_ROOT'] . Announcement::ANNOUNCEMENT_DIRECTORY . $announce->id();
     if (is_dir($directory)) {
         return $directory;
     }
     return null;
 }
 public function loadModel($id)
 {
     $model = Announcement::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #3
1
 /**
  * Return the announcment(s) for the given scope.
  * If no scope is given, the global announcment will
  * be returned.  In any case, a published global announcment
  * will be stored in the "global" attribute in the bean.
  * If the published flag is set, the method will return the
  * content value if published or an empty string if not.
  * 
  * @param string $scope (e.g. Exhibition, Program, Course, Global)
  * @param boolean $published Return just the published value? [false]
  * @param boolean $global Also set and return the published global content? [false]
  * @return bean The announcment bean for the given scope 
  */
 public function getAnnouncement($scope, $published = false, $global = false)
 {
     global $logger;
     $logger->debug(get_class($this) . "::getAnnouncment({$scope})");
     $notice = new Announcement();
     // get the scoped announcement
     if ($scope != null) {
         $section = $this->fetch($scope);
         $snotice = $section->content;
         if ($published && !$section->published) {
             $snotice = "";
         }
     }
     // get the global announcement
     if ($global) {
         $global = $this->fetch('Global');
         $gnotice = $global->content;
         if ($published && !$global->published) {
             $gnotice = "";
         }
         $notice->setGlobal($gnotice);
     }
     $notice->setContent($snotice);
     $notice->setScope($scope);
     if ($section != null) {
         $notice->setPublished($section->getPublished());
         $notice->setOid($section->getOid());
     }
     return $notice;
 }
예제 #4
1
}

</style>
<div class="row">

<div class="col-md-6">

	<div class="panel panel-danger">
	  <div class="panel-heading">
	    <h3 class="panel-title" align="center"><span class="glyphicon glyphicon-pushpin">   </span>
	    	Announcements</h3>
	  </div><div class="tab-content">
	  <div class="panel-body" align="center">

<?php 
$announcements = Announcement::paginate(4);
?>

@foreach ($announcements as $announcement)
	<div class="col-md-6">
		<div class="panel panel-default">
		  <div class="panel-heading">
		    <h3 style="color:black;"class="panel-title" align="center">
		    	{{ $announcement-> title }}</h3>
		  </div>

		  <div class="panel-body" align="center">

		  {{ str_limit($announcement->content, 40) }} <br> <br>

		  	-{{ $announcement->user->formatName(':fn :ln') }} <br>
 /**
  * Méthode permettant d'enregistrer une annonce pro
  * @param $announcement L'annonce pro à enregistrer
  * @return void
  */
 public function save(Announcement $announcement)
 {
     if ($announcement->isValid()) {
         $announcement->isNew() ? $this->add($announcement) : $this->modify($announcement);
     } else {
         throw new RuntimeException('L\'annonce pro doit être valide pour être enregistrée');
     }
 }
예제 #6
0
 public function actionIndex()
 {
     //取出公告数据
     $notice = Announcement::model()->findAll(array('order' => 'create_time DESC', 'condition' => 'status=:status', 'params' => array(':status' => 2)));
     $notice = CJSON::decode(CJSON::encode($notice));
     Out::jsonOutput($notice);
 }
예제 #7
0
 public function run()
 {
     $user = Announcement::create(['user_id' => '2', 'title' => 'Announcement Title', 'content' => 'This is the content', 'date_posted' => '2015-10-25']);
     $user = Announcement::create(['user_id' => '1', 'title' => 'Its a beautiful day', 'content' => 'Content of the beautiful day', 'date_posted' => '2015-10-25']);
     $user = Announcement::create(['user_id' => '2', 'title' => 'Testing out the site', 'content' => 'Were testing out alright', 'date_posted' => '2015-10-25']);
     $user = Announcement::create(['user_id' => '1', 'title' => 'Shucks', 'content' => 'Lorem ipsum dolor venti dfdk vdkfdkfd dffkdfldfkdfdkfd dfdf', 'date_posted' => '2015-10-25']);
 }
예제 #8
0
 function toHTML()
 {
     $HTML = '';
     if ($this->_ShowLogo) {
         $HTML .= freshports_Logo();
     }
     if ($this->_ShowAnnouncements) {
         $Announcement = new Announcement($this->{$_db});
         $NumRows = $Announcement->FetchAllActive();
         if ($NumRows > 0) {
             $HTML .= DisplayAnnouncements($Announcement);
         }
     }
     $HTML .= freshports_MainTable() . "\n<tr><td width='100%' valign='top'>\n" . freshports_MainContentTable() . "\n<tr>\n" . freshports_PageBannerText($this->_title);
     $this->prependBodyContent($HTML);
     $this->addBodyContent("\n</table><td valign=\"top\">" . freshports_SideBar() . "</td></tr></table>\n" . freshports_ShowFooter());
     return parent::toHTML();
 }
 function render()
 {
     $condition['live'] = ANNOUNCE_LIVE;
     //live announcements having status = '1'
     $param = array();
     $this->announcement = Announcement::load_announcements_array($param, $condition);
     $this->inner_HTML = $this->generate_inner_html($this->announcement);
     $announcement = parent::render();
     return $announcement;
 }
 public function AddAnnouncement()
 {
     $user = ServiceLocator::GetServer()->GetUserSession();
     $text = $this->page->GetText();
     $start = Date::Parse($this->page->GetStart(), $user->Timezone);
     $end = Date::Parse($this->page->GetEnd(), $user->Timezone);
     $priority = $this->page->GetPriority();
     Log::Debug('Adding new Announcement');
     $this->announcementRepository->Add(Announcement::Create($text, $start, $end, $priority));
 }
 public function testAddsAnnouncement()
 {
     $text = 'text';
     $start = Date::Parse('2011-01-01', 'America/Chicago');
     $end = NullDate::Instance();
     $priority = 1;
     $announcement = Announcement::Create($text, $start, $end, $priority);
     $this->repository->Add($announcement);
     $this->assertEquals(new AddAnnouncementCommand($text, $start, $end, $priority), $this->db->_LastCommand);
 }
예제 #12
0
 /**
  * Internal function to return an Announcement object from a row.
  * @param $row array
  * @return Announcement
  */
 function &_returnAnnouncementFromRow(&$row)
 {
     $announcement = new Announcement();
     $announcement->setId($row['announcement_id']);
     $announcement->setAssocType($row['assoc_type']);
     $announcement->setAssocId($row['assoc_id']);
     $announcement->setTypeId($row['type_id']);
     $announcement->setDateExpire($this->dateFromDB($row['date_expire']));
     $announcement->setDatePosted($this->datetimeFromDB($row['date_posted']));
     $this->getDataObjectSettings('announcement_settings', 'announcement_id', $row['announcement_id'], $announcement);
     return $announcement;
 }
예제 #13
0
 public function testPut()
 {
     $announcement = new Announcement();
     $announcement->setId('1');
     $announcement->setTitle('Annonce test');
     $announcement->setSubtitle('Description modifiée');
     $announcement->setContent('Besoin de mécanicien contre cours de cuisine');
     $announcement->setPostDate('2012-12-14 18:07:27');
     $announcement->setConclued('0');
     $announcementMapper = new AnnouncementMapper();
     $announcementMapper->setId(1);
     $announcementMapper->updateAnnouncement($announcement);
     $this->assertEquals($announcement, $announcementMapper->selectAnnouncement());
 }
 public function getDelete($id)
 {
     // Find the announcement using the id
     $announcement = Announcement::find($id);
     if ($announcement == null) {
         $errors = new \Illuminate\Support\MessageBag();
         $errors->add('deleteError', "The data cannot be deleted at this time.");
         return \Redirect::to('/admin/announcements')->withErrors($errors);
     }
     // Delete all images
     $announcement->deleteAllImages();
     // Delete the announcement
     $announcement->delete();
     return \Redirect::to('admin/announcements');
 }
예제 #15
0
 public function index()
 {
     error_reporting(0);
     $this->content_view = 'home';
     $this->data['announcements'] = Announcement::get_announcements();
     $this->load->helper('twitch');
     load_api_interface();
     $result = json_decode(file_get_contents("https://api.twitch.tv/kraken/streams?game=StepMania&limit=4"));
     $this->data['streams'] = $result->streams;
     $this->data['recent_scores'] = User_score::get_recent_scores();
     $this->data['new_songs'] = Ranked_file::get_recent_files();
     $this->data['new_packs'] = Pack::get_recent_packs();
     $this->data['online_users'] = User::get_online_users();
     $this->data['leaderboards'] = Leaderboards_cache::get_all_lbs();
 }
예제 #16
0
 public function actionLogin()
 {
     if (!Ibos::app()->user->isGuest) {
         $this->redirect(Ibos::app()->urlManager->createUrl("main/default/index"));
     }
     $account = UserUtil::getAccountSetting();
     if (!EnvUtil::submitCheck("loginsubmit", 1)) {
         $announcement = Announcement::model()->fetchByTime(TIMESTAMP);
         $data = array("assetUrl" => $this->getAssetUrl("user"), "lang" => Ibos::getLangSources(), "unit" => Ibos::app()->setting->get("setting/unit"), "account" => $account, "cookietime" => $account["cookietime"], "announcement" => $announcement, "loginBg" => LoginTemplate::model()->fetchAll("`disabled`= 0 AND `image`!=''"));
         $this->setTitle(Ibos::lang("Login page"));
         $this->renderPartial("login", $data);
     } else {
         $userName = EnvUtil::getRequest("username");
         $loginType = EnvUtil::getRequest("logintype");
         $passWord = EnvUtil::getRequest("password");
         $autoLogin = EnvUtil::getRequest("autologin");
         $cookieTime = EnvUtil::getRequest("cookietime");
         $this->doLogin($userName, $passWord, $loginType, $account, $autoLogin, $cookieTime);
     }
 }
예제 #17
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/global.php';
require_once DOC_ROOT . '/includes/classes/class.html.php';
require_once DOC_ROOT . '/includes/classes/class.user.php';
require_once DOC_ROOT . '/includes/classes/class.announcement.php';
$user_id = get_param('user_id');
if (!$user_id) {
    redirect('/login.php');
}
$id = get_param('id');
if (!$id) {
    redirect('/city_home.php');
}
$announcement = new Announcement($id);
$user = new User($user_id);
$friends = $user->get_friend_list();
$select_friends = true;
if (!empty($_POST)) {
    $select_friends = false;
    $screen = get_param('screen');
    if ($screen == 1) {
        $friend_ndx = get_param('friend_ndx');
        $friend_ndx_list = implode('|', $friend_ndx);
    } elseif ($screen == 2) {
        $friend_ndx_list = get_param('friend_ndx_list');
        $message = get_param('message');
        $user->tell_friends($friend_ndx_list, $message);
    }
}
$html = new HTML();
         $error_msg .= $value . ' can not be empty<br>';
     }
 }
 // saving value if announcement fails for any reason
 $vartoset = array('title', 'body', 'position', 'action');
 filter_all_post($_POST);
 //filters all data of html
 for ($i = 0; $i < count($vartoset); $i += 1) {
     $var = $vartoset[$i];
     if (!empty($_POST[$var])) {
         $form_data[$var] = $_POST[$var];
     }
 }
 //if no error so far
 if (!$error_msg) {
     $announcement = new Announcement();
     $position_available = FALSE;
     if ($aid) {
         $condition1['content_id'] = $aid;
         $position_available = Announcement::is_position_available($_POST['position'], $condition1);
     } else {
         $position_available = Announcement::is_position_available($_POST['position']);
     }
     if ($position_available == TRUE) {
         $announcement->status = LIVE;
     } else {
         $announcement->status = ARCHIVED;
     }
     //for parent ie content class
     $announcement->title = $_POST['title'];
     $announcement->body = $_POST['body'];
예제 #19
0
 public function actionSystemNotice()
 {
     //查询出公告数据
     $notice = Announcement::model()->findAll(array('order' => 'create_time DESC', 'condition' => 'status=:status', 'params' => array(':status' => 2)));
     $notice = CJSON::decode(CJSON::encode($notice));
     foreach ($notice as $k => $v) {
         $notice[$k]['create_time'] = date('Y-m-d', $v['create_time']);
     }
     $this->render('systemnotice', array('announce' => $notice));
 }
예제 #20
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/global.php';
require_once DOC_ROOT . '/includes/classes/class.user.php';
require_once DOC_ROOT . '/includes/classes/class.city.php';
require_once DOC_ROOT . '/includes/classes/class.announcement_feedback.php';
$id = get_param('id');
$feedback_id = get_param('fid');
$announcement = new Announcement($id);
$data = array('status' => '-1');
if (!empty($announcement)) {
    $feedback = new Announcement_Feedback($feedback_id);
    $feedback->user_id($user_id);
    $response = get_param('response');
    if (abs(1 * $response) == 1) {
        $feedback->response($response);
        $feedback_id = $feedback->record_response($id);
        $data = array('announcement_id' => $id, 'response_type' => "opinion: {$response}", 'feedback_id' => $feedback_id, 'comment_data' => $announcement->comment_data);
    } else {
        $feedback->comments(get_param('comments'));
        $feedback->update();
        $data = array('announcement_id' => $id, 'response_type' => 'comments', 'comment_data' => $announcement->get_comment_data());
    }
}
return_jsonp_data($data);
예제 #21
0
 public function actionAnnouncement()
 {
     //print_r($_POST);exit;
     $announment = new Announcement();
     $announment->uploadsourcetype = 61;
     $announment->uploadsourceid = $_POST['groupid'];
     $announment->announcement = $_POST['announcement'];
     $announment->createdby = Yii::app()->session['login']['id'];
     $announment->createddate = new CDbExpression('NOW()');
     $announment->status = 1;
     if ($announment->save(false)) {
         $this->redirect(Yii::app()->createUrl('group/dashboard', array('groupid' => $_POST['groupid'])));
     }
 }
 function importAnnouncements()
 {
     assert($this->xml->name == 'announcements');
     $journal = $this->journal;
     $announcementTypeDAO =& DAORegistry::getDAO('AnnouncementTypeDAO');
     $announcementDAO =& DAORegistry::getDAO('AnnouncementDAO');
     $this->nextElement();
     while ($this->xml->name == 'announcementType') {
         $announcementTypeXML = $this->getCurrentElementAsDom();
         $announcementType = new AnnouncementType();
         $announcementType->setAssocType(ASSOC_TYPE_JOURNAL);
         $announcementType->setAssocId($this->journal->getId());
         $announcementTypeDAO->insertAnnouncementType($announcementType);
         $this->restoreDataObjectSettings($announcementTypeDAO, $announcementTypeXML->settings, 'announcement_type_settings', 'type_id', $announcementType->getId());
         foreach ($announcementTypeXML->announcement as $announcementXML) {
             $announcement = new Announcement();
             $announcement->setAssocType(ASSOC_TYPE_JOURNAL);
             $announcement->setAssocId($this->journal->getId());
             $announcement->setTypeId($announcementType->getId());
             $announcement->setDateExpire((string) $announcementXML->dateExpire);
             $announcement->setDatePosted((string) $announcementXML->datePosted);
             $announcementDAO->insertAnnouncement($announcement);
             $this->restoreDataObjectSettings($announcementDAO, $announcementXML->settings, 'announcement_settings', 'announcement_id', $announcement->getId());
         }
         $this->nextElement();
     }
 }
예제 #23
0
function freshports_Start($ArticleTitle, $Description, $Keywords, $Phorum = 0)
{
    global $ShowAds;
    global $BannerAd;
    global $ShowAnnouncements;
    freshports_HTML_Start();
    freshports_Header($ArticleTitle, $Description, $Keywords, $Phorum);
    freshports_body();
    echo freshports_Logo();
    freshports_navigation_bar_top();
    if (isset($ShowAnnouncements)) {
        global $db;
        $Announcement = new Announcement($db);
        $NumRows = $Announcement->FetchAllActive();
        if ($NumRows > 0) {
            echo DisplayAnnouncements($Announcement);
        }
    }
}
 /**
 * Display the specified resource.
 *
 * @param  int  $id
 * @return Response
 */
 public function show($id)
 {
     $user = Auth::user();
     $club = $user->clubs()->FirstOrFail();
     $event = Evento::find($id);
     $participants = $event->participants;
     $schedule = $event->schedule->groupBy('date');
     $emaillist = "";
     foreach ($event->participants as $item) {
         $emaillist .= $item->email . ",";
     }
     $title = 'League Together - ' . $event->name . ' Event';
     $announcements = Announcement::where('event_id', $event->id)->get();
     return View::make('app.club.event.show')->with('page_title', $title)->withEvent($event)->withClub($club)->withUser($user)->with('schedule', $schedule)->with('announcements', $announcements)->withParticipants($participants);
 }
 private function fillAnnouncement(array $data, Announcement $ann)
 {
     $ann->setText($data['text'])->setDate(new Date($data['date']));
     return $ann;
 }
* [description including history]
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* @author [creator, or "Original Author"]
* @license http://bit.ly/aVWqRV PayAsYouGo License
* @copyright Copyright (c) 2010 Broadband Mechanics
* @package PeopleAggregator
*/
$login_required = TRUE;
include_once "web/includes/page.php";
require_once "api/Content/Content.php";
require_once "api/Announcement/Announcement.php";
require_once "api/Permissions/PermissionsHandler.class.php";
if ($_GET['aid']) {
    $params = array('permissions' => 'delete_content', 'cid' => $_GET['aid']);
    if (PermissionsHandler::can_user(PA::$login_uid, $params)) {
        $announcement = new Announcement();
        $announcement->content_id = $_GET['aid'];
        $announcement->delete();
    }
}
if (PA::$network_info) {
    $nid = PA::$network_info->network_id;
} else {
    $nid = '';
}
//unique name
$cache_id = 'content_' . $_GET['cid'] . $nid;
CachedTemplate::invalidate_cache($cache_id);
$location = PA::$url . '/network_announcement.php';
header("Location: {$location}");
exit;
예제 #27
0
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/global.php';
require_once DOC_ROOT . '/includes/classes/class.html.php';
require_once DOC_ROOT . '/includes/classes/class.user.php';
require_once DOC_ROOT . '/includes/classes/class.city.php';
require_once DOC_ROOT . '/includes/classes/class.announcement_feedback.php';
$user_id = get_param('user_id');
if (!$user_id) {
    redirect('/login.php');
}
$id = get_param('id');
log_time("Announcement {$id}");
if (!$id) {
    log_time('Returning to home.');
    redirect('/index.php');
}
$announcement = new Announcement($id);
if (!empty($_POST)) {
    log_time('Preparing to process feedback.');
    $feedback = new Announcement_Feedback();
    log_time('new Feedback');
    $feedback->response(get_param('response'));
    log_time('response');
    $feedback->comments(get_param('response_comments'));
    log_time('comments');
    $feedback->user_id($user_id);
    log_time('user_id');
    $feedback->announcement_id($id);
    log_time('announcement_id');
    $feedback->record_response();
    log_time('record_response');
    redirect('/announcement_feedback_response.php?id=' . $id);
예제 #28
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/global.php';
require_once DOC_ROOT . '/includes/classes/class.user.php';
require_once DOC_ROOT . '/includes/classes/class.city.php';
require_once DOC_ROOT . '/includes/classes/class.announcement_feedback.php';
$id = get_param('id');
$announcement = new Announcement($id);
$data = array('id' => $id, 'type' => ANNOUNCEMENT_TYPE, 'title' => $announcement->title(), 'description' => $announcement->text(), 'text' => $announcement->text(), 'category' => array('id' => $announcement->category['id'], 'name' => $announcement->category['name']), 'question' => $announcement->question(), 'location' => $announcement->location(), 'image' => $announcement->get_image_src(), 'status' => $announcement->status->status(), 'calendared' => $announcement->calendared(), 'vote' => $announcement->vote(), 'support' => $announcement->get_support(), 'oppose' => $announcement->get_oppose(), 'days_remaining' => $announcement->days_remaining(), 'sponsors' => $announcement->sponsors, 'comment_data' => $announcement->comment_data, 'user_feedback' => $announcement->feedback_submitted($user_id));
return_jsonp_data($data);
예제 #29
0
                    ?>
                    <form action="" method="post" class="styled">
                        <label style="width: 100px;">SQL Query</label>
                    
                        <input type="text" name="query" value="" />

                        <input style="margin-left: 25px;" type="submit" value="Execute query" />
                        	
                    </form>
                    <?php 
                }
                echo '</div>
                    </div>';
                break;
            case "manage-announcements":
                $announcement = new Announcement();
                echo '
					<div style="overflow: auto;" id="admin">
                    <div style="float: left; width: 160px;">';
                echo '<ul id="subMenu">';
                echo '<li><a href="?page=' . $_GET['page'] . '&amp;action=' . $_GET['action'] . '&amp;do=add-announcement"';
                if ($_GET['do'] == 'add-announcement' || empty($_GET['do'])) {
                    echo ' class="current"';
                }
                echo '>Add announcement</a></li>';
                echo '<li><a href="?page=' . $_GET['page'] . '&amp;action=' . $_GET['action'] . '&amp;do=edit-announcement"';
                if ($_GET['do'] == 'edit-announcement') {
                    echo ' class="current"';
                }
                echo '>Edit announcement</a></li>';
                echo '<li><a href="?page=' . $_GET['page'] . '&amp;action=' . $_GET['action'] . '&amp;do=delete-announcement"';
예제 #30
0
 public function Update(Announcement $announcement)
 {
     ServiceLocator::GetDatabase()->Execute(new UpdateAnnouncementCommand($announcement->Id(), $announcement->Text(), $announcement->Start(), $announcement->End(), $announcement->Priority()));
 }