Ejemplo n.º 1
1
 public function displayDataset($ids)
 {
     $criteria = new CDbCriteria();
     $criteria->addInCondition("id", $ids);
     $datasets = Dataset::model()->findAll($criteria);
     $this->generateFeed($datasets);
 }
Ejemplo n.º 2
0
 public function testInvalidDatasetDescription()
 {
     $invalidTest = array('user_id' => 1, 'dataset_name' => 'Franklin Park Run', 'description' => 'This description is 256 characters long ' . 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna. Nunc viverra imperdiet enim. Fusce est. Vivamus a tel');
     $invalidDataset = new Dataset($invalidTest);
     $this->assertEquals(1, $invalidDataset->getErrorCount(), 'The Dataset object should have exactly 1 error');
     $this->assertTrue(!empty($invalidDataset->getError('description')), 'The Dataset should have a description error');
 }
Ejemplo n.º 3
0
 private function ApplyFilter()
 {
     $fieldNames = array();
     $fieldFilters = array();
     foreach ($this->dataset->GetFields() as $field) {
         if ($this->page->GetSimpleSearchAvailable() && $this->page->GetGrid()->SearchControl instanceof SimpleSearch) {
             if ($this->page->GetGrid()->SearchControl->ContainsField($field->GetName())) {
                 if ($field->GetEngFieldType() != ftBlob) {
                     $fieldNames[] = $field->GetName();
                     $fieldFilters[] = new FieldFilter('%' . $this->value . '%', 'ILIKE', true);
                 }
             } else {
                 if ($this->dataset->IsLookupFieldByPrimaryName($field->GetName()) != null) {
                     $lookupFieldName = $this->dataset->IsLookupFieldByPrimaryName($field->GetName());
                     if ($this->page->GetGrid()->SearchControl->ContainsField($lookupFieldName)) {
                         $fieldNames[] = $lookupFieldName;
                         $fieldFilters[] = new FieldFilter('%' . $this->value . '%', 'ILIKE', true);
                     }
                 }
             }
         }
     }
     if (count($fieldFilters) > 0) {
         $this->dataset->AddCompositeFieldFilter('OR', $fieldNames, $fieldFilters);
     }
 }
Ejemplo n.º 4
0
 /**
  * @param array $oldValues associative array (fieldNames => fieldValues) of old values
  * @param array $newValues associative array (fieldNames => fieldValues) of new values
  * @param IDataset|Dataset $dataset dataset where changes between old and new values must be written
  */
 protected function WriteChangesToDataset($oldValues, $newValues, Dataset $dataset)
 {
     foreach ($newValues as $fieldName => $fieldValue) {
         if ($dataset->DoNotRewriteUnchangedValues()) {
             if (!isset($oldValues[$fieldName]) || $oldValues[$fieldName] != $fieldValue) {
                 $dataset->SetFieldValueByName($fieldName, $fieldValue);
             }
         } else {
             $dataset->SetFieldValueByName($fieldName, $fieldValue);
         }
     }
 }
Ejemplo n.º 5
0
    /**
     * Init all days for beeing displayed
     */
    protected function initDays()
    {
        $this->initShortModes();
        $this->initEmptyDays();
        $WhereNotPrivate = FrontendShared::$IS_SHOWN && !Configuration::Privacy()->showPrivateActivitiesInList() ? 'AND is_public=1' : '';
        $AllTrainings = $this->DB->query('
			SELECT
				id,
				time,
				`s` as `s_sum_with_distance`,
				DATE(FROM_UNIXTIME(time)) as `date`
				' . $this->Dataset->getQuerySelectForAllDatasets() . '
			FROM `' . PREFIX . 'training`
			WHERE `time` BETWEEN ' . ($this->timestamp_start - 10) . ' AND ' . ($this->timestamp_end - 10) . '
                        AND accountid = ' . SessionAccountHandler::getId() . '
				' . $WhereNotPrivate . '
			ORDER BY `time` ASC
		')->fetchAll();
        foreach ($AllTrainings as $Training) {
            $w = Time::diffInDays($Training['time'], $this->timestamp_start);
            if (in_array($Training['sportid'], $this->sports_short) || in_array($Training['typeid'], $this->types_short)) {
                $this->days[$w]['shorts'][] = $Training;
            } else {
                $this->days[$w]['trainings'][] = $Training;
            }
        }
    }
    public function actionNotification(){
        $this->lastdataset=Yii::app()->basePath."/scripts/data/lastdataset.txt";

        $filecontent= $this->readFile();
        $temp = json_decode($filecontent,true);
        $lastdataset=isset($temp['lastdataset'])?$temp['lastdataset']:0;
        $lastTimeRun=isset($temp['lastTimeRun'])?$temp['lastTimeRun']:0;


        $now=microtime(true);
        $lastestDataset = Dataset::model()->find("id=(SELECT MAX(id) FROM dataset)");

        

        if(($lastestDataset->id-$lastdataset > $this->numberOfNewDataset) || ( ($now-$lastTimeRun)>$this->timeWaitPeriod  ) && $lastestDataset->id-$lastdataset >0){
            $newDatasets = Dataset::model()->findAll("id>?",array($lastdataset));
            $content= $this->generateEmail($newDatasets);
            $this->sendBroadcastEmail($this->emailSubject,$content);

            // Store Information for next time
            $temp['lastdataset'] = $lastestDataset->id;
            $temp['lastTimeRun'] = floor($now);
            $this->writeFile(json_encode($temp));
        }else {
            echo "Don't have enough dataset";
        }
    }
Ejemplo n.º 7
0
 public function dataset($config)
 {
     /**
      * $config['other_infos'] ==> contine date suplimentare
      **/
     return Dataset::response($config);
 }
Ejemplo n.º 8
0
    private function sendNotificationEmail($list,$user,$criteria){
        $app_email_name = Yii::app()->params['app_email_name'];
        $app_email = Yii::app()->params['app_email'];
        $email_prefix = Yii::app()->params['email_prefix'];
        $headers = "From: $app_email_name <$app_email>\r\n"; //optional header fields
        $headers .= "Content-type: text/html\r\n";
        ini_set('sendmail_from', $app_email);

        $listurl="";
        foreach ($list as $key => $value) {
            $model = Dataset::model()->findByPk($value);
            $url = Yii::app()->params['home_url']."/dataset/".$model->identifier;
            $author_list = '';
            if (count($model->authors) > 0) {
                  $i = 0;
                foreach( $model->authors as $key => $author){
                    if (++$i < count($model->authors)) $author_list .= $author->name.';'; else $author_list .= $author->name.' ';
                }
            }
            $listurl .= <<<EO_LU
<span style='font-weight:bold;'>{$model->title}</span><br>
{$author_list}<br>
<a href='{$url}'>{$url}</a><br><br>
EO_LU;
        }

        $recipient = Yii::app()->params['notify_email'];
        $subject = "GigaDB has new content which matches your interest";

        $body = CController::renderInternal(Yii::app()->basePath.'/views/search/emailMatchedSearches.php',array('listurl'=>$listurl,'criteria'=>$criteria),true);

        mail($user->email, $subject, $body, $headers);
        Yii::log(__FUNCTION__."> Sent email to $recipient, $subject");
    }
Ejemplo n.º 9
0
 public function testComplexCase()
 {
     $r = new LinearRegression(Dataset::fromArray([0.5, 1, 4, -1]));
     $this->assertSame(-0.15, $r->slope());
     $this->assertSame(1.35, $r->intercept());
     $this->assertSame(0.0, $r(9));
 }
Ejemplo n.º 10
0
 private function getFullDatasetResultByKeyword($keyword)
 {
     $wordCriteria = array();
     $wordCriteria['keyword'] = $keyword;
     $list_result_dataset_criteria = $this->searchDataset($wordCriteria);
     $temp_dataset_criteria = new CDbCriteria();
     $temp_dataset_criteria->addInCondition("id", $list_result_dataset_criteria);
     return Dataset::model()->findAll($temp_dataset_criteria);
 }
 public static function getDatasetsArray($rows)
 {
     $datasets = array();
     if (!empty($rows)) {
         // Convert the array of arrays into an array of Datasets
         // and set the id and date_created fields
         foreach ($rows as $datasetRow) {
             $dataset = new Dataset($datasetRow);
             $datasetId = $datasetRow['dataset_id'];
             $dataset->setDatasetId($datasetId);
             $datasetDateCreated = $datasetRow['date_created'];
             $dataset->setDateCreated($datasetDateCreated);
             // TODO: We should also get the dataset's associated sensors
             // Coordinate this in the controller
             array_push($datasets, $dataset);
         }
     }
     return $datasets;
 }
Ejemplo n.º 12
0
 /**
  * Display all training rows
  */
 private function displayTrainingRows()
 {
     foreach ($this->Trainings as $training) {
         $date = date("d.m.Y", $training['time']);
         $link = Ajax::trainingLink($training['id'], $date, true);
         echo '<tr class="r">';
         echo '<td class="l"><small>' . $link . '</small></td>';
         $this->Dataset->setActivityData($training);
         $this->Dataset->displayTableColumns();
         echo '</tr>';
     }
 }
 public function createLog($dataset_id, $message)
 {
     #only save the log when dataset is public
     $dataset = Dataset::model()->findByPk($dataset_id);
     if ($dataset->IsPublic) {
         $log = new DatasetLog();
         $log->dataset_id = $dataset_id;
         $log->message = $message;
         $log->model = $this->Owner->tableName();
         $log->model_id = $this->Owner->id;
         $log->save(false);
     }
 }
Ejemplo n.º 14
0
 public static function FormatDatasetFieldsTemplate(Dataset $dataset, $template, IDelegate $processValue = null)
 {
     $result = $template;
     foreach ($dataset->GetFields() as $field) {
         if ($dataset->IsLookupField($field->GetNameInDataset())) {
             $result = StringUtils::ReplaceVariableInTemplate($result, $field->GetAlias(), $processValue == null ? $dataset->GetFieldValueByName($field->GetAlias()) : $processValue->Call($dataset->GetFieldValueByName($field->GetAlias()), $field->GetAlias()));
         } else {
             $result = StringUtils::ReplaceVariableInTemplate($result, $field->GetName(), $processValue == null ? $dataset->GetFieldValueByName($field->GetNameInDataset()) : $processValue->Call($dataset->GetFieldValueByName($field->GetNameInDataset()), $field->GetNameInDataset()));
         }
     }
     return $result;
 }
 protected function GetActualKeys()
 {
     $keys = array('Primary' => false, 'Foreign' => false);
     if ($this->GetGrid()->GetShowKeyColumnsImagesInHeader()) {
         if ($this->dataset->IsFieldPrimaryKey($this->fieldName)) {
             $keys['Primary'] = true;
         }
         if ($this->dataset->IsLookupField($this->fieldName)) {
             $keys['Foreign'] = true;
             if ($this->dataset->IsLookupFieldNameByDisplayFieldName($this->fieldName)) {
                 if ($this->dataset->IsFieldPrimaryKey($this->dataset->IsLookupFieldNameByDisplayFieldName($this->fieldName))) {
                     $keys['Primary'] = true;
                 }
             }
         }
     }
     return $keys;
 }
 public function get($id)
 {
     $this->queryDataset->bindValue(':id', intval($id), PDO::PARAM_INT);
     $this->queryDataset->execute();
     $datasets = $this->queryDataset->fetchAll(PDO::FETCH_ASSOC);
     $numDatasets = count($datasets);
     $this->queryDataset->closeCursor();
     if ($numDatasets < 1) {
         throw new Exception(self::$EXCEPTION_NO_DATASET);
     } else {
         if ($numDatasets > 1) {
             throw new Exception(self::$EXCEPTION_MULT_DATASETS);
         } else {
             $dataset = $datasets[0];
             $dataset['iml'] = $this->_dbStringToArray($dataset['iml']);
             return Dataset::fromArray($dataset);
         }
     }
 }
Ejemplo n.º 17
0
 public function actionIndex()
 {
     $limit = 10;
     $offset = 0;
     while (true) {
         $datasets = Dataset::model()->findAll(array("order" => "identifier ASC", "limit" => $limit, "offset" => $offset));
         if (!$datasets) {
             break;
         }
         foreach ($datasets as $dataset) {
             $cite = $dataset->cited;
             $dataset->citation = $cite['total'];
             $dataset->save();
         }
         if (count($datasets) < $limit) {
             break;
         }
         $offset = $offset + $limit;
     }
 }
Ejemplo n.º 18
0
    public function run($args)
    {
        $site = '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
        // datasets
        foreach (Dataset::model()->findAll() as $dataset) {
            $url = 'dataset/' . $dataset->identifier;
            $site .= $this->createUrlBlock($url, null, 'weekly', 1.0);
        }
        // news
        foreach (News::model()->findAll() as $newsItem) {
            $url = 'news/id/' . $newsItem->id;
            $site .= $this->createUrlBlock($url, null, 'weekly', 0.5);
        }
        // static pages
        $site .= $this->createUrlBlock('site/about', null, 'yearly', 0.3);
        $site .= $this->createUrlBlock('site/contact', null, 'yearly', 0.3);
        $site .= $this->createUrlBlock('site/term', null, 'yearly', 0.3);
        $site .= '</urlset>';
        //write to file
        $file = fopen(dirname(__FILE__) . "/../../sitemap.xml", 'w');
        fwrite($file, $site);
        fclose($file);
    }
Ejemplo n.º 19
0
 /**
  * Display table body
  */
 protected function displayTableBody()
 {
     $maxIndex = ceil(($this->TimeEnd - $this->TimeStart) / $this->Timerange) - 1;
     $CompleteData = array();
     $CompleteResult = $this->Dataset->getGroupOfTrainingsForTimerange($this->Sportid, $this->Timerange, $this->TimeStart, $this->TimeEnd);
     foreach ($CompleteResult as $Data) {
         $CompleteData[$Data['timerange']] = $Data;
     }
     for ($index = 0; $index <= $maxIndex; ++$index) {
         echo '<tr><td class="l"><span class="b">' . $this->rowHead($index) . '</span></td>';
         if (isset($CompleteData[$index]) && !empty($CompleteData[$index])) {
             echo '<td class="small">' . $CompleteData[$index]['num'] . 'x</td>';
             $this->displayAdditionalColumns($CompleteData[$index]);
             $this->Dataset->setGroupOfTrainings($CompleteData[$index]);
             if (isset($CompleteData[$index + 1])) {
                 $this->Dataset->setKilometerToCompareTo($CompleteData[$index + 1]['distance']);
             }
             $this->Dataset->displayTableColumns();
         } else {
             echo HTML::emptyTD($this->Dataset->cols() + 1 + $this->AdditionalColumns, '<em>' . __('No activities') . '</em>', 'c small');
         }
         echo '</tr>';
     }
 }
Ejemplo n.º 20
0
    /**
      * Draw a sample for use with legend
      * @param int $x The x coordinate to draw the sample at
      * @param int $y The y coordinate to draw the sample at
      * @access private
      */
    function _legendSample($x, $y, &$font)
    {
        if (is_a($this->_fillStyle, "Image_Graph_Fill")) {
            $fillStyle = $this->_fillStyle->_getFillStyleAt($x -5, $y -5, 10, 10);
        } else {
            $fillStyle = $this->_getFillStyle();
        }
        if ($fillStyle != IMG_COLOR_TRANSPARENT) {
            ImageFilledRectangle($this->_canvas(), $x -5, $y -5, $x +5, $y +5, $fillStyle);
            ImageRectangle($this->_canvas(), $x -5, $y -5, $x +5, $y +5, $this->_getLineStyle());
        } else {
            ImageLine($this->_canvas(), $x -7, $y, $x +7, $y, $this->_getLineStyle());
        }

        if (($this->_marker) and ($this->_dataset)) {
            $this->_dataset->_reset();
            $point = $this->_dataset->_next();
            $prevPoint = $this->_dataset->_nearby(-2);
            $nextPoint = $this->_dataset->_nearby();

            $point = $this->_getMarkerData($point, $nextPoint, $prevPoint, $i);
            if (is_array($point)) {
                $point['MARKER_X'] = $x;
                $point['MARKER_Y'] = $y;
                unset ($point['AVERAGE_Y']);
                $this->_marker->_drawMarker($point['MARKER_X'], $point['MARKER_Y'], $point);
            }
        }

        $text = new Image_Graph_Text($x + 20, $y, $this->_title, $font);
        $text->setAlignment(IMAGE_GRAPH_ALIGN_CENTER_Y | IMAGE_GRAPH_ALIGN_LEFT);
        $this->add($text);
        $text->_done();

        return array('Width' => 20+$font->width($this->_title), 'Height' => max(10, $font->height($this->_title)));
    }
Ejemplo n.º 21
0
 /**
  * @param Renderer $renderer
  * @return void
  */
 public function Render(Renderer $renderer)
 {
     /** @var string $term */
     $term = '';
     if ($this->GetSuperGlobals()->IsGetValueSet('term')) {
         $term = $this->GetSuperGlobals()->GetGetValue('term');
     }
     if (!StringUtils::IsNullOrEmpty($term)) {
         $this->dataset->AddFieldFilter($this->valueField, new FieldFilter('%' . $term . '%', 'ILIKE', true));
     }
     $id = null;
     if ($this->GetSuperGlobals()->IsGetValueSet('id')) {
         $id = $this->GetSuperGlobals()->GetGetValue('id');
     }
     if (!StringUtils::IsNullOrEmpty($id)) {
         $this->dataset->AddFieldFilter($this->idField, FieldFilter::Equals($id));
     }
     header('Content-Type: text/html; charset=utf-8');
     $this->dataset->Open();
     $result = array();
     $valueCount = 0;
     while ($this->dataset->Next()) {
         $result[] = array("id" => $this->dataset->GetFieldValueByName($this->idField), "value" => StringUtils::IsNullOrEmpty($this->captionTemplate) ? $this->dataset->GetFieldValueByName($this->valueField) : DatasetUtils::FormatDatasetFieldsTemplate($this->dataset, $this->captionTemplate));
         if (++$valueCount >= 20) {
             break;
         }
     }
     echo SystemUtils::ToJSON($result);
     $this->dataset->Close();
 }
Ejemplo n.º 22
0
 public function getDashboardMenuItems($instance)
 {
     // determine if the Twitter Realtime plugin is active.
     $rt_plugin_active = false;
     $plugin_dao = DAOFactory::getDAO('PluginDAO');
     $plugin_id = $plugin_dao->getPluginId('twitterrealtime');
     if (isset($plugin_id)) {
         $rt_plugin_active = $plugin_dao->isPluginActive($plugin_id);
     }
     $menus = array();
     $tweets_data_tpl = Utils::getPluginViewDirectory('twitter') . 'tweets.tpl';
     $tweets_menu_item = new MenuItem("Tweets", "Tweets insights", $tweets_data_tpl);
     $tweets_menu_ds_1 = new Dataset("all_tweets", 'PostDAO', "getAllPosts", array($instance->network_user_id, 'twitter', 5, "#page_number#"), 'getAllPostsIterator', array($instance->network_user_id, 'twitter', GridController::getMaxRows()));
     $tweets_menu_ds_1->addHelp('userguide/listings/twitter/dashboard_tweets-all');
     $tweets_menu_item->addDataset($tweets_menu_ds_1);
     $menus['tweets'] = $tweets_menu_item;
     $tweets_menu_ds_2 = new Dataset("inquiries", 'PostDAO', "getAllQuestionPosts", array($instance->network_user_id, 'twitter', 5, "#page_number#"));
     $tweets_menu_ds_2->addHelp('userguide/listings/twitter/dashboard_tweets-questions');
     $tweets_menu_item->addDataset($tweets_menu_ds_2);
     $tweets_menu_ds_3 = new Dataset("most_replied_to_tweets", 'PostDAO', "getMostRepliedToPosts", array($instance->network_user_id, 'twitter', 5, '#page_number#'));
     $tweets_menu_ds_3->addHelp('userguide/listings/twitter/dashboard_tweets-mostreplies');
     $tweets_menu_item->addDataset($tweets_menu_ds_3);
     //        $tweets_menu_ds_7 = new Dataset("author_replies", 'PostDAO', "getPostsAuthorHasRepliedTo",
     //        array($instance->network_user_id, 5, 'twitter', '#page_number#', !Session::isLoggedIn()));
     //        $tweets_menu_ds_7->addHelp('userguide/listings/twitter/dashboard_tweets-convo');
     //        $tweets_menu_item->addDataset($tweets_menu_ds_7);
     $tweets_menu_ds_4 = new Dataset("most_retweeted", 'PostDAO', "getMostRetweetedPosts", array($instance->network_user_id, 'twitter', 5, '#page_number#'));
     $tweets_menu_ds_4->addHelp('userguide/listings/twitter/dashboard_tweets-mostretweeted');
     $tweets_menu_item->addDataset($tweets_menu_ds_4);
     $tweets_menu_ds_5 = new Dataset("messages_to_you", 'PostDAO', "getPostsToUser", array($instance->network_user_id, $instance->network, 5, '#page_number#', !Session::isLoggedIn()), 'getPostsToUserIterator', array($instance->network_user_id, $instance->network, GridController::getMaxRows()));
     $tweets_menu_ds_5->addHelp('userguide/listings/twitter/dashboard_tweets-touser');
     $tweets_menu_item->addDataset($tweets_menu_ds_5);
     $tweets_menu_ds_6 = new Dataset("favorites", 'FavoritePostDAO', "getAllFavoritePosts", array($instance->network_user_id, 'twitter', 5, "#page_number#", !Session::isLoggedIn()), 'getAllFavoritePostsIterator', array($instance->network_user_id, 'twitter', GridController::getMaxRows()));
     $tweets_menu_ds_6->addHelp('userguide/listings/twitter/dashboard_ftweets-all');
     $tweets_menu_item->addDataset($tweets_menu_ds_6);
     $follower_data_tpl = Utils::getPluginViewDirectory('twitter') . 'followers.tpl';
     $followers_menu_item = new MenuItem("Followers", "Follower insights", $follower_data_tpl);
     $menus['followers'] = $followers_menu_item;
     $followers_ds1 = new Dataset('leastlikely', 'FollowDAO', "getLeastLikelyFollowers", array($instance->network_user_id, 'twitter', 13, '#page_number#'));
     $followers_menu_item->addDataset($followers_ds1);
     $followers_ds9 = new Dataset('leastlikelythisweek', 'InsightDAO', "getPreCachedInsightData", array('FollowMySQLDAO::getLeastLikelyFollowersThisWeek', $instance->id, date('Y-m-d')));
     $followers_menu_item->addDataset($followers_ds9);
     $followers_ds2 = new Dataset("popular", 'FollowDAO', "getMostFollowedFollowers", array($instance->network_user_id, 'twitter', 13, '#page_number#'));
     $followers_ds2->addHelp('userguide/listings/twitter/dashboard_followers-mostfollowed');
     $followers_menu_item->addDataset($followers_ds2);
     $followers_ds3 = new Dataset("follower_count_history_by_day", 'FollowerCountDAO', 'getHistory', array($instance->network_user_id, 'twitter', 'DAY', 15));
     $followers_menu_item->addDataset($followers_ds3);
     $followers_ds4 = new Dataset("follower_count_history_by_week", 'FollowerCountDAO', 'getHistory', array($instance->network_user_id, 'twitter', 'WEEK', 15));
     $followers_menu_item->addDataset($followers_ds4);
     $followers_ds5 = new Dataset("follower_count_history_by_month", 'FollowerCountDAO', 'getHistory', array($instance->network_user_id, 'twitter', 'MONTH', 15));
     $followers_ds5->addHelp('userguide/listings/twitter/dashboard_followers-history');
     $followers_menu_item->addDataset($followers_ds5);
     $followers_ds6 = new Dataset("list_membership_count_history_by_day", 'GroupMembershipCountDAO', 'getHistory', array($instance->network_user_id, 'twitter', 'DAY', 15));
     $followers_menu_item->addDataset($followers_ds6);
     $followers_ds7 = new Dataset("list_membership_count_history_by_week", 'GroupMembershipCountDAO', 'getHistory', array($instance->network_user_id, 'twitter', 'WEEK', 15));
     $followers_menu_item->addDataset($followers_ds7);
     $followers_ds8 = new Dataset("list_membership_count_history_by_month", 'GroupMembershipCountDAO', 'getHistory', array($instance->network_user_id, 'twitter', 'MONTH', 15));
     $followers_ds8->addHelp('userguide/listings/twitter/dashboard_followers-liststats');
     $followers_menu_item->addDataset($followers_ds8);
     $who_you_follow_data_tpl = Utils::getPluginViewDirectory('twitter') . 'who_you_follow.tpl';
     $who_you_follow_menu_item = new MenuItem("Who You Follow", "Friend insights", $who_you_follow_data_tpl);
     $menus['you-follow'] = $who_you_follow_menu_item;
     $you_follow_ds1 = new Dataset('chatterboxes', 'FollowDAO', "getMostActiveFollowees", array($instance->network_user_id, 'twitter', 13, '#page_number#'));
     $you_follow_ds1->addHelp('userguide/listings/twitter/dashboard_friends-mostactive');
     $who_you_follow_menu_item->addDataset($you_follow_ds1);
     $you_follow_ds2 = new Dataset("deadbeats", 'FollowDAO', "getLeastActiveFollowees", array($instance->network_user_id, 'twitter', 13, '#page_number#'));
     $you_follow_ds2->addHelp('userguide/listings/twitter/dashboard_friends-leastactive');
     $who_you_follow_menu_item->addDataset($you_follow_ds2);
     $you_follow_ds3 = new Dataset("popular", 'FollowDAO', "getMostFollowedFollowees", array($instance->network_user_id, 'twitter', 13, '#page_number#'));
     $you_follow_ds3->addHelp('userguide/listings/twitter/dashboard_followers-mostfollowed');
     $who_you_follow_menu_item->addDataset($you_follow_ds3);
     $links_data_tpl = Utils::getPluginViewDirectory('twitter') . 'links.tpl';
     $links_menu_item = new MenuItem("Links", "Links insights", $links_data_tpl);
     $menus['links'] = $links_menu_item;
     $links_ds_1 = new Dataset("linksinfaves", 'LinkDAO', "getLinksByFavorites", array($instance->network_user_id, 'twitter', 5, '#page_number#', !Session::isLoggedIn()));
     $links_ds_1->addHelp('userguide/listings/twitter/dashboard_links-favorites');
     $links_menu_item->addDataset($links_ds_1);
     $links_ds_2 = new Dataset("linksbyfriends", 'LinkDAO', "getLinksByFriends", array($instance->network_user_id, 'twitter', 5, '#page_number#', !Session::isLoggedIn()));
     $links_ds_2->addHelp('userguide/listings/twitter/dashboard_links-friends');
     $links_menu_item->addDataset($links_ds_2);
     $links_ds_3 = new Dataset("photosbyfriends", 'LinkDAO', "getPhotosByFriends", array($instance->network_user_id, 'twitter', 5, '#page_number#', !Session::isLoggedIn()));
     $links_ds_3->addHelp('userguide/listings/twitter/dashboard_links-photos');
     $links_menu_item->addDataset($links_ds_3);
     //inner items
     $twitter_data_tpl = Utils::getPluginViewDirectory('twitter') . 'twitter.inline.view.tpl';
     //All tab
     $all_mi = new MenuItem("Your tweets", "All your tweets", $twitter_data_tpl, "tweets");
     $all_mi_ds = new Dataset("all_tweets", 'PostDAO', "getAllPosts", array($instance->network_user_id, 'twitter', 15, "#page_number#"), 'getAllPostsIterator', array($instance->network_user_id, 'twitter', GridController::getMaxRows()));
     $all_mi_ds->addHelp('userguide/listings/twitter/dashboard_tweets-all');
     $all_mi->addDataset($all_mi_ds);
     $menus['tweets-all'] = $all_mi;
     //Questions
     $q_mi = new MenuItem("Inquiries", "Inquiries, or tweets with a question mark in them", $twitter_data_tpl, 'tweets');
     $q_mi_ds = new Dataset("all_tweets", 'PostDAO', "getAllQuestionPosts", array($instance->network_user_id, 'twitter', 15, "#page_number#"));
     $q_mi_ds->addHelp('userguide/listings/twitter/dashboard_tweets-questions');
     $q_mi->addDataset($q_mi_ds);
     $menus['tweets-questions'] = $q_mi;
     // Most replied-to
     $mrt_mi = new MenuItem("Most replied-to", "Tweets with most replies", $twitter_data_tpl, 'tweets');
     $mrt_mi_ds = new Dataset("most_replied_to_tweets", 'PostDAO', "getMostRepliedToPosts", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $mrt_mi_ds->addHelp('userguide/listings/twitter/dashboard_tweets-mostreplies');
     $mrt_mi->addDataset($mrt_mi_ds);
     $menus['tweets-mostreplies'] = $mrt_mi;
     // Most shared
     $mstab = new MenuItem("Most retweeted", "Most retweeted tweets", $twitter_data_tpl, 'tweets');
     $mstabds = new Dataset("most_retweeted", 'PostDAO', "getMostRetweetedPosts", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $mstabds->addHelp('userguide/listings/twitter/dashboard_tweets-mostretweeted');
     $mstab->addDataset($mstabds);
     $menus["tweets-mostretweeted"] = $mstab;
     if ($rt_plugin_active) {
         // 'home timeline'
         $tltab = new MenuItem("Timeline", "Your Timeline", $twitter_data_tpl, 'tweets');
         $tltab2 = new Dataset("home_timeline", 'PostDAO', "getPostsByFriends", array($instance->network_user_id, $instance->network, 20, '#page_number#', !Session::isLoggedIn()), 'getPostsByFriendsIterator', array($instance->network_user_id, 'twitter', GridController::getMaxRows()));
         $tltab->addDataset($tltab2);
         $menus["home-timeline"] = $tltab;
     }
     // Conversations
     $convotab = new MenuItem("Conversations", "Exchanges between you and other users", $twitter_data_tpl, 'tweets');
     $convotabds = new Dataset("author_replies", 'PostDAO', "getPostsAuthorHasRepliedTo", array($instance->network_user_id, 15, 'twitter', '#page_number#', !Session::isLoggedIn()));
     $convotabds->addHelp('userguide/listings/twitter/dashboard_tweets-convo');
     $convotab->addDataset($convotabds);
     $menus["tweets-convo"] = $convotab;
     // Messages to you
     $messagestab = new MenuItem("Tweets to you", "Tweets other users sent you", $twitter_data_tpl, 'tweets');
     $messagestabds = new Dataset("messages_to_you", 'PostDAO', "getPostsToUser", array($instance->network_user_id, $instance->network, 15, '#page_number#', !Session::isLoggedIn()), 'getPostsToUserIterator', array($instance->network_user_id, $instance->network, GridController::getMaxRows()));
     $messagestabds->addHelp('userguide/listings/twitter/dashboard_tweets-touser');
     $messagestab->addDataset($messagestabds);
     $menus["tweets-messages"] = $messagestab;
     // Most popular tweets of the year
     $current_year = intval(date('Y'));
     $year = $current_year;
     if (isset($_GET['y'])) {
         if (is_numeric($_GET['y'])) {
             $year_param = intval($_GET['y']);
             if ($year_param >= 2005 && $year_param <= $current_year) {
                 $year = $year_param;
             }
         }
     }
     $yearly_popular_tab = new MenuItem("Top 25 Posts of " . $year, "Most retweeted and replied-to tweets of " . $year . ".", $twitter_data_tpl, 'tweets');
     $yearly_popular_tab_dataset = new Dataset("years_most_popular", 'PostDAO', "getMostPopularPostsOfTheYear", array($instance->network_user_id, $instance->network, $year, 25));
     $yearly_popular_tab->addDataset($yearly_popular_tab_dataset);
     $menus["years_most_popular"] = $yearly_popular_tab;
     $fvalltab = new MenuItem("Favorites", "All your favorites", $twitter_data_tpl, 'tweets');
     $fvalltabds = new Dataset("all_tweets", 'FavoritePostDAO', "getAllFavoritePosts", array($instance->network_user_id, 'twitter', 20, "#page_number#", !Session::isLoggedIn()), 'getAllFavoritePostsIterator', array($instance->network_user_id, 'twitter', GridController::getMaxRows()));
     $fvalltabds->addHelp('userguide/listings/twitter/dashboard_ftweets-all');
     $fvalltab->addDataset($fvalltabds);
     $menus["ftweets-all"] = $fvalltab;
     //Most Active Friends
     $motab = new MenuItem('Chatterboxes', 'People you follow who tweet the most', $twitter_data_tpl, 'you-follow');
     $motabds = new Dataset('people', 'FollowDAO', "getMostActiveFollowees", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $motabds->addHelp('userguide/listings/twitter/dashboard_friends-mostactive');
     $motab->addDataset($motabds);
     $menus["friends-mostactive"] = $motab;
     //Least Active Friends
     $latab = new MenuItem('Quietest', 'People you follow who tweet the least', $twitter_data_tpl, 'you-follow');
     $latabds = new Dataset("people", 'FollowDAO', "getLeastActiveFollowees", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $latabds->addHelp('userguide/listings/twitter/dashboard_friends-leastactive');
     $latab->addDataset($latabds);
     $menus["friends-leastactive"] = $latab;
     //Popular friends
     $poptab = new MenuItem('Popular', 'Most-followed people you follow', $twitter_data_tpl, 'you-follow');
     $poptabds = new Dataset("people", 'FollowDAO', "getMostFollowedFollowees", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $poptabds->addHelp('userguide/listings/twitter/dashboard_followers-mostfollowed');
     $poptab->addDataset($poptabds);
     $menus["friends-mostfollowed"] = $poptab;
     //Least likely/Most Discerning
     $lltab = new MenuItem("Discerning", 'Followers with the greatest follower-to-friend ratio', $twitter_data_tpl, 'followers');
     $lltabds = new Dataset("people", 'FollowDAO', "getLeastLikelyFollowers", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $lltabds->addHelp('userguide/listings/twitter/dashboard_followers-leastlikely');
     $lltab->addDataset($lltabds);
     $menus["followers-leastlikely"] = $lltab;
     //Most followed
     $mftab = new MenuItem('Popular', 'Followers with the most followers', $twitter_data_tpl, 'followers');
     $mftabds = new Dataset("people", 'FollowDAO', "getMostFollowedFollowers", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $mftabds->addHelp('userguide/listings/twitter/dashboard_followers-mostfollowed');
     $mftab->addDataset($mftabds);
     $menus["followers-mostfollowed"] = $mftab;
     //Follower count history
     $follower_history_tpl = Utils::getPluginViewDirectory('twitter') . 'twitter.followercount.tpl';
     $trendtab = new MenuItem('Count history', 'Your follower count over time', $follower_history_tpl, 'followers');
     $trendtabds = new Dataset("follower_count_history_by_day", 'FollowerCountDAO', 'getHistory', array($instance->network_user_id, 'twitter', 'DAY', 15));
     $trendtab->addDataset($trendtabds);
     $trendtabweekds = new Dataset("follower_count_history_by_week", 'FollowerCountDAO', 'getHistory', array($instance->network_user_id, 'twitter', 'WEEK', 15));
     $trendtab->addDataset($trendtabweekds);
     $trendtabmonthds = new Dataset("follower_count_history_by_month", 'FollowerCountDAO', 'getHistory', array($instance->network_user_id, 'twitter', 'MONTH', 11));
     $trendtabmonthds->addHelp('userguide/listings/twitter/dashboard_followers-history');
     $trendtab->addDataset($trendtabmonthds);
     $menus['followers-history'] = $trendtab;
     //List membership count history
     $group_membership_history_tpl = Utils::getPluginViewDirectory('twitter') . 'twitter.listmembershipcount.tpl';
     $group_trend_tab = new MenuItem('List stats', 'Your list membership count over time', $group_membership_history_tpl, 'followers');
     $group_trend_tab_ds = new Dataset("list_membership_count_history_by_day", 'GroupMembershipCountDAO', 'getHistory', array($instance->network_user_id, 'twitter', 'DAY', 15));
     $group_trend_tab->addDataset($group_trend_tab_ds);
     $group_trend_tab_week_ds = new Dataset("list_membership_count_history_by_week", 'GroupMembershipCountDAO', 'getHistory', array($instance->network_user_id, 'twitter', 'WEEK', 15));
     $group_trend_tab->addDataset($group_trend_tab_week_ds);
     $group_trend_tab_month_ds = new Dataset("list_membership_count_history_by_month", 'GroupMembershipCountDAO', 'getHistory', array($instance->network_user_id, 'twitter', 'MONTH', 11));
     $group_trend_tab_month_ds->addHelp('userguide/listings/twitter/dashboard_followers-liststats');
     $group_trend_tab->addDataset($group_trend_tab_month_ds);
     $menus['group-membership-history'] = $group_trend_tab;
     if ($rt_plugin_active) {
         $fvdtab = new MenuItem("Favorited by Others", "Favorited by Others", $twitter_data_tpl, 'links');
         $ftab2 = new Dataset("all_favd", 'FavoritePostDAO', "getAllFavoritedPosts", array($instance->network_user_id, $instance->network, 20, '#page_number#'));
         $fvdtab->addDataset($ftab2);
         $menus["favd-all"] = $fvdtab;
     }
     //Links from favorites
     $lftab = new MenuItem('Links in favorites', 'Links in posts you favorited', $twitter_data_tpl, 'links');
     $lftabds = new Dataset("links", 'LinkDAO', "getLinksByFavorites", array($instance->network_user_id, 'twitter', 15, '#page_number#', !Session::isLoggedIn()));
     $lftabds->addHelp('userguide/listings/twitter/dashboard_links-favorites');
     $lftab->addDataset($lftabds);
     $menus["links-favorites"] = $lftab;
     //Links from friends
     $fltab = new MenuItem('Links by who you follow', 'Links your friends posted', $twitter_data_tpl, 'links');
     $fltabds = new Dataset("links", 'LinkDAO', "getLinksByFriends", array($instance->network_user_id, 'twitter', 15, '#page_number#', !Session::isLoggedIn()));
     $fltabds->addHelp('userguide/listings/twitter/dashboard_links-friends');
     $fltab->addDataset($fltabds);
     $menus["links-friends"] = $fltab;
     //Photos
     $ptab = new MenuItem("Photos by who you follow", 'Photos your friends have posted', $twitter_data_tpl, 'links');
     $ptabds = new Dataset("links", 'LinkDAO', "getPhotosByFriends", array($instance->network_user_id, 'twitter', 15, '#page_number#', !Session::isLoggedIn()));
     $ptabds->addHelp('userguide/listings/twitter/dashboard_links-photos');
     $ptab->addDataset($ptabds);
     $menus["links-photos"] = $ptab;
     return $menus;
 }
Ejemplo n.º 23
0
 public function getDashboardMenuItems($instance)
 {
     $menus = array();
     $posts_data_tpl = Utils::getPluginViewDirectory('facebook') . 'posts.tpl';
     $posts_menu_item = new MenuItem("Posts", "Post insights", $posts_data_tpl);
     $posts_menu_ds_1 = new Dataset("all_posts", 'PostDAO', "getAllPosts", array($instance->network_user_id, $instance->network, 5, "#page_number#"), 'getAllPostsIterator', array($instance->network_user_id, $instance->network, GridController::getMaxRows()), false);
     $posts_menu_item->addDataset($posts_menu_ds_1);
     $posts_menu_ds_2 = new Dataset("most_replied_to", 'PostDAO', "getMostRepliedToPosts", array($instance->network_user_id, $instance->network, 5, '#page_number#'));
     $posts_menu_item->addDataset($posts_menu_ds_2);
     $posts_menu_ds_3 = new Dataset("most_liked", 'PostDAO', "getMostFavedPosts", array($instance->network_user_id, $instance->network, 5, '#page_number#'));
     $posts_menu_item->addDataset($posts_menu_ds_3);
     $posts_menu_ds_4 = new Dataset("inquiries", 'PostDAO', "getAllQuestionPosts", array($instance->network_user_id, $instance->network, 5, "#page_number#"));
     $posts_menu_item->addDataset($posts_menu_ds_4);
     $posts_menu_ds_5 = new Dataset("wallposts", 'PostDAO', "getPostsToUser", array($instance->network_user_id, $instance->network, 5, '#page_number#', !Session::isLoggedIn()), 'getPostsToUserIterator', array($instance->network_user_id, $instance->network, GridController::getMaxRows()));
     $posts_menu_item->addDataset($posts_menu_ds_5);
     $menus['posts'] = $posts_menu_item;
     $friends_data_tpl = Utils::getPluginViewDirectory('facebook') . 'friends.tpl';
     $friend_fan_menu_title = $instance->network == 'facebook page' ? 'Fans' : 'Friends';
     $friends_menu_item = new MenuItem($friend_fan_menu_title, "Friends insights", $friends_data_tpl);
     $friends_menu_ds_2 = new Dataset("follower_count_history_by_day", 'CountHistoryDAO', 'getHistory', array($instance->network_user_id, $instance->network, 'DAY', 15));
     $friends_menu_item->addDataset($friends_menu_ds_2);
     $friends_menu_ds_3 = new Dataset("follower_count_history_by_week", 'CountHistoryDAO', 'getHistory', array($instance->network_user_id, $instance->network, 'WEEK', 15));
     $friends_menu_item->addDataset($friends_menu_ds_3);
     $friends_menu_ds_4 = new Dataset("follower_count_history_by_month", 'CountHistoryDAO', 'getHistory', array($instance->network_user_id, $instance->network, 'MONTH', 11));
     $friends_menu_item->addDataset($friends_menu_ds_4);
     $menus['friends'] = $friends_menu_item;
     $fb_data_tpl = Utils::getPluginViewDirectory('facebook') . 'facebook.inline.view.tpl';
     //All tab
     $alltab = new MenuItem("All posts", 'All your status updates', $fb_data_tpl, 'posts');
     $alltabds = new Dataset("all_facebook_posts", 'PostDAO', "getAllPosts", array($instance->network_user_id, $instance->network, 15, "#page_number#"), 'getAllPostsIterator', array($instance->network_user_id, $instance->network, GridController::getMaxRows()), false);
     $alltabds->addHelp('userguide/listings/facebook/dashboard_all_facebook_posts');
     $alltab->addDataset($alltabds);
     $menus["posts-all"] = $alltab;
     // Most replied-to tab
     $mrttab = new MenuItem("Most replied-to", "Posts with most replies", $fb_data_tpl, 'posts');
     $mrttabds = new Dataset("most_replied_to_posts", 'PostDAO', "getMostRepliedToPosts", array($instance->network_user_id, $instance->network, 15, '#page_number#'));
     $mrttabds->addHelp('userguide/listings/facebook/dashboard_mostreplies');
     $mrttab->addDataset($mrttabds);
     $menus["posts-mostreplies"] = $mrttab;
     // Most liked posts
     $mltab = new MenuItem("Most liked", "Posts with most likes", $fb_data_tpl, 'posts');
     $mltabds = new Dataset("most_replied_to_posts", 'PostDAO', "getMostFavedPosts", array($instance->network_user_id, $instance->network, 15, '#page_number#'));
     $mltabds->addHelp('userguide/listings/facebook/dashboard_mostlikes');
     $mltab->addDataset($mltabds);
     $menus["posts-mostlikes"] = $mltab;
     //Questions tab
     $qtab = new MenuItem("Inquiries", "Inquiries, or posts with a question mark in them", $fb_data_tpl, 'posts');
     $qtabds = new Dataset("all_facebook_posts", 'PostDAO', "getAllQuestionPosts", array($instance->network_user_id, $instance->network, 15, "#page_number#"));
     $qtabds->addHelp('userguide/listings/facebook/dashboard_questions');
     $qtab->addDataset($qtabds);
     $menus["posts-questions"] = $qtab;
     // Wall Posts
     $messagestab = new MenuItem("Posts On Your Wall", "Posts to your wall by other users", $fb_data_tpl, 'posts');
     $messagestabds = new Dataset("messages_to_you", 'PostDAO', "getPostsToUser", array($instance->network_user_id, $instance->network, 15, '#page_number#', !Session::isLoggedIn()), 'getPostsToUserIterator', array($instance->network_user_id, $instance->network, GridController::getMaxRows()));
     $messagestabds->addHelp('userguide/listings/facebook/dashboard-wallposts');
     $messagestab->addDataset($messagestabds);
     $menus["posts-toyou"] = $messagestab;
     return $menus;
 }
Ejemplo n.º 24
0
 private function ApplyFilterToDataset()
 {
     $fieldNames = array();
     $fieldFilters = array();
     foreach ($this->columns as $column) {
         if ($column->IsFilterActive()) {
             $fieldNames[] = $column->GetFieldName();
             $fieldFilters[] = $column->GetFilterForField();
         }
     }
     if (count($fieldFilters) > 0) {
         $this->dataset->AddCompositeFieldFilter($this->applyAndOperator ? 'AND' : 'OR', $fieldNames, $fieldFilters);
     }
     $this->isActive = count($fieldFilters) > 0;
 }
Ejemplo n.º 25
0
 public function getDatasetByType($type)
 {
     if ($type > 0) {
         $models = Dataset::model()->findAllBySql("SELECT * FROM dataset JOIN dataset_type ON dataset.id=dataset_type.dataset_id WHERE dataset_type.type_id=:type_id AND dataset.upload_status = 'Published' limit 9", array(':type_id' => $type));
     } else {
         $models = Dataset::model()->findAllBySql("SELECT * FROM dataset WHERE dataset.upload_status = 'Published' limit 9");
     }
     return $models;
 }
Ejemplo n.º 26
0
 /**
  * @param mixed $currentPageNumber
  * @param Dataset $dataset
  */
 function ApplyPageToDataset($currentPageNumber, Dataset $dataset)
 {
     if (!isset($currentPageNumber) || $currentPageNumber == '') {
         $this->FillUserPartitions();
         $userPartitionsKeys = array_keys($this->userPartitions);
         if ($this->GetAllowViewAllRecords()) {
             $currentPageNumber = null;
         } else {
             $currentPageNumber = $userPartitionsKeys[0];
         }
     }
     if (isset($currentPageNumber)) {
         $condition = $this->DoOnGetPartitionCondition($currentPageNumber);
         if (isset($condition) && $condition != '') {
             $dataset->AddCustomCondition($condition);
         }
     }
 }
 private function GetFilterConditionAsSQL(Dataset $dataset, FilterCondition $filter)
 {
     if (count($filter->GetValues()) == 0 && count($filter->GetDisplayValues()) > 0) {
         $newFilter = new FilterCondition($dataset->IsLookupFieldByPrimaryName($filter->GetFieldName()), $filter->GetOperator(), $filter->GetDisplayValue(0));
         $legacyFilter = $this->CreateLegacyFilter($newFilter);
     } else {
         $legacyFilter = $this->CreateLegacyFilter($filter);
     }
     return $this->legacyGenerator->CreateCondition($legacyFilter, $dataset->GetFieldInfoByName($filter->GetFieldName()));
 }
Ejemplo n.º 28
0
<div class="tab-content">
    <?php 
foreach ($datasets['data'] as $dt) {
    ?>
    <?php 
    $dataset = Dataset::model()->findByPk($dt);
    $dsamples = $dataset->getSamplesInIds($samples['data']);
    $dfiles = $dataset->getFilesInIds($files['data']);
    ?>
    <div class="search-result-container">
        <!--Dataset section-->
        <?php 
    $is_display = in_array('dataset', $display) || in_array('file', $display) && $dfiles || in_array('sample', $display) && $dsamples;
    ?>
        <?php 
    if ($is_display) {
        ?>
        <div class="row">
            <div class="span1 logo-container"><img src="/images/icons/g-new-icon.png">
            </div>
            <div class="span8 main-content">
                <ul class="nav nav-tabs nav-stacked result-cell">
                  <li><a data-content="<?php 
        echo MyHtml::encode($dataset->description);
        ?>
" class="result-main-link left content-popup" href="<?php 
        echo $dataset->shortUrl;
        ?>
"><?php 
        echo $dataset->title;
        ?>
Ejemplo n.º 29
0
 public function getDashboardMenuItems($instance)
 {
     $twitter_data_tpl = Utils::getPluginViewDirectory('twitter') . 'twitter.inline.view.tpl';
     $menus = array();
     //All tab
     $all_mi = new MenuItem("All Tweets", "All tweets", $twitter_data_tpl, "Tweets");
     $all_mi_ds = new Dataset("all_tweets", 'PostDAO', "getAllPosts", array($instance->network_user_id, 'twitter', 15, "#page_number#"), 'getAllPostsIterator', array($instance->network_user_id, 'twitter', GridController::getMaxRows()));
     $all_mi_ds->addHelp('userguide/listings/twitter/dashboard_tweets-all');
     $all_mi->addDataset($all_mi_ds);
     $menus['tweets-all'] = $all_mi;
     //Questions
     $q_mi = new MenuItem("Inquiries", "Inquiries, or tweets with a question mark in them", $twitter_data_tpl);
     $q_mi_ds = new Dataset("all_tweets", 'PostDAO', "getAllQuestionPosts", array($instance->network_user_id, 'twitter', 15, "#page_number#"));
     $q_mi_ds->addHelp('userguide/listings/twitter/dashboard_tweets-questions');
     $q_mi->addDataset($q_mi_ds);
     $menus['tweets-questions'] = $q_mi;
     // Most replied-to
     $mrt_mi = new MenuItem("Most replied-to", "Tweets with most replies", $twitter_data_tpl);
     $mrt_mi_ds = new Dataset("most_replied_to_tweets", 'PostDAO', "getMostRepliedToPosts", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $mrt_mi_ds->addHelp('userguide/listings/twitter/dashboard_tweets-mostreplies');
     $mrt_mi->addDataset($mrt_mi_ds);
     $menus['tweets-mostreplies'] = $mrt_mi;
     // Most shared
     $mstab = new MenuItem("Most retweeted", "Most retweeted tweets", $twitter_data_tpl);
     $mstabds = new Dataset("most_retweeted", 'PostDAO', "getMostRetweetedPosts", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $mstabds->addHelp('userguide/listings/twitter/dashboard_tweets-mostretweeted');
     $mstab->addDataset($mstabds);
     $menus["tweets-mostretweeted"] = $mstab;
     if (Session::isLoggedIn()) {
         //show protected tweets
         //All Mentions
         $amtab = new MenuItem("All Mentions", "Any post that mentions you", $twitter_data_tpl, 'Replies');
         $amtabds1 = new Dataset("all_tweets", 'PostDAO', "getAllPosts", array($instance->network_user_id, 'twitter', 15), "getAllMentionsIterator", array($instance->network_username, GridController::getMaxRows(), 'twitter'));
         $amtabds2 = new Dataset("all_mentions", 'PostDAO', "getAllMentions", array($instance->network_username, 15, $instance->network, '#page_number#'));
         $amtabds2->addHelp('userguide/listings/twitter/dashboard_mentions-all');
         $amtab->addDataset($amtabds1);
         $amtab->addDataset($amtabds2);
         $menus["mentions-all"] = $amtab;
         //All Replies
         $artab = new MenuItem("Replies", "Posts that directly reply to you (i.e., start with your name)", $twitter_data_tpl);
         $artabds = new Dataset("all_replies", 'PostDAO', "getAllReplies", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
         $artabds->addHelp('userguide/listings/twitter/dashboard_mentions-allreplies');
         $artab->addDataset($artabds);
         $menus["mentions-allreplies"] = $artab;
         //All Orphan Mentions
         $omtab = new MenuItem("Not Replies or Forwards", "Mentions that are not associated with a specific post", $twitter_data_tpl);
         $omtabds1 = new Dataset("all_tweets", 'PostDAO', "getAllPosts", array($instance->network_user_id, 'twitter', 15));
         $omtabds2 = new Dataset("orphan_replies", 'PostDAO', "getOrphanReplies", array($instance->network_username, 15, $instance->network, '#page_number#'));
         $omtabds2->addHelp('userguide/listings/twitter/dashboard_mentions-orphan');
         $omtab->addDataset($omtabds1);
         $omtab->addDataset($omtabds2);
         $menus["mentions-orphan"] = $omtab;
     } else {
         //All public mentions
         $amtab = new MenuItem("All Mentions", "Any post that mentions you", $twitter_data_tpl, 'Replies');
         $amtabds2 = new Dataset("all_mentions", 'PostDAO', "getAllMentions", array($instance->network_username, 15, $instance->network, '#page_number#', true));
         $amtabds2->addHelp('userguide/listings/twitter/dashboard_mentions-all');
         $amtab->addDataset($amtabds2);
         $menus["mentions-all"] = $amtab;
     }
     // Conversations
     $convotab = new MenuItem("Conversations", "Exchanges between you and other users", $twitter_data_tpl);
     $convotabds = new Dataset("author_replies", 'PostDAO', "getPostsAuthorHasRepliedTo", array($instance->network_user_id, 15, 'twitter', '#page_number#', !Session::isLoggedIn()));
     $convotabds->addHelp('userguide/listings/twitter/dashboard_tweets-convo');
     $convotab->addDataset($convotabds);
     $menus["tweets-convo"] = $convotab;
     //Most Active Friends
     $motab = new MenuItem('Chatterboxes', 'People you follow who tweet the most', $twitter_data_tpl, 'Who You Follow');
     $motabds = new Dataset('people', 'FollowDAO', "getMostActiveFollowees", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $motabds->addHelp('userguide/listings/twitter/dashboard_friends-mostactive');
     $motab->addDataset($motabds);
     $menus["friends-mostactive"] = $motab;
     //Least Active Friends
     $latab = new MenuItem('Deadbeats', 'People you follow who tweet the least', $twitter_data_tpl);
     $latabds = new Dataset("people", 'FollowDAO', "getLeastActiveFollowees", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $latabds->addHelp('userguide/listings/twitter/dashboard_friends-leastactive');
     $latab->addDataset($latabds);
     $menus["friends-leastactive"] = $latab;
     //Popular friends
     $poptab = new MenuItem('Popular', 'Most-followed people you follow', $twitter_data_tpl);
     $poptabds = new Dataset("people", 'FollowDAO', "getMostFollowedFollowees", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $poptabds->addHelp('userguide/listings/twitter/dashboard_followers-mostfollowed');
     $poptab->addDataset($poptabds);
     $menus["friends-mostfollowed"] = $poptab;
     //Follower count history
     $follower_history_tpl = Utils::getPluginViewDirectory('twitter') . 'twitter.followercount.tpl';
     $trendtab = new MenuItem('Follower Count', 'Your follower count over time', $follower_history_tpl, 'Followers');
     $trendtabds = new Dataset("follower_count_history_by_day", 'FollowerCountDAO', 'getHistory', array($instance->network_user_id, 'twitter', 'DAY', 15));
     $trendtab->addDataset($trendtabds);
     $trendtabweekds = new Dataset("follower_count_history_by_week", 'FollowerCountDAO', 'getHistory', array($instance->network_user_id, 'twitter', 'WEEK', 15));
     $trendtab->addDataset($trendtabweekds);
     $trendtabmonthds = new Dataset("follower_count_history_by_month", 'FollowerCountDAO', 'getHistory', array($instance->network_user_id, 'twitter', 'MONTH', 11));
     $trendtabmonthds->addHelp('userguide/listings/twitter/dashboard_followers-history');
     $trendtab->addDataset($trendtabmonthds);
     $menus['followers-history'] = $trendtab;
     //Most followed
     $mftab = new MenuItem('Most-followed', 'Followers with most followers', $twitter_data_tpl);
     $mftabds = new Dataset("people", 'FollowDAO', "getMostFollowedFollowers", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $mftabds->addHelp('userguide/listings/twitter/dashboard_followers-mostfollowed');
     $mftab->addDataset($mftabds);
     $menus["followers-mostfollowed"] = $mftab;
     //Least likely/Most Discerning
     $lltab = new MenuItem("Most Discerning", 'Followers with the greatest follower-to-friend ratio', $twitter_data_tpl);
     $lltabds = new Dataset("people", 'FollowDAO', "getLeastLikelyFollowers", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $lltabds->addHelp('userguide/listings/twitter/dashboard_followers-leastlikely');
     $lltab->addDataset($lltabds);
     $menus["followers-leastlikely"] = $lltab;
     //Earliest
     $eftab = new MenuItem("Earliest Joiners", 'Followers ordered by what date they created their Twitter ' . 'account', $twitter_data_tpl);
     $eftabds = new Dataset("people", 'FollowDAO', "getEarliestJoinerFollowers", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $eftabds->addHelp('userguide/listings/twitter/dashboard_followers-earliest');
     $eftab->addDataset($eftabds);
     $menus["followers-earliest"] = $eftab;
     $fvalltab = new MenuItem("Your Favorites", "All your favorites", $twitter_data_tpl, 'Favorites');
     $fvalltabds = new Dataset("all_tweets", 'FavoritePostDAO', "getAllFavoritePosts", array($instance->network_user_id, 'twitter', 20, "#page_number#"), 'getAllFavoritePostsIterator', array($instance->network_user_id, 'twitter', GridController::getMaxRows()));
     $fvalltabds->addHelp('userguide/listings/twitter/dashboard_ftweets-all');
     $fvalltab->addDataset($fvalltabds);
     $menus["ftweets-all"] = $fvalltab;
     $fvdtab = new MenuItem("Favorited by Others", "Favorited by Others", $twitter_data_tpl);
     $ftab2 = new Dataset("all_favd", 'FavoritePostDAO', "getAllFavoritedPosts", array($instance->network_user_id, $instance->network, 20, '#page_number#'));
     $fvdtab->addDataset($ftab2);
     $menus["favd-all"] = $fvdtab;
     //Links from friends
     $fltab = new MenuItem('Links from People You Follow', 'Links your friends posted', $twitter_data_tpl, 'Links');
     $fltabds = new Dataset("links", 'LinkDAO', "getLinksByFriends", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $fltabds->addHelp('userguide/listings/twitter/dashboard_links-friends');
     $fltab->addDataset($fltabds);
     $menus["links-friends"] = $fltab;
     //Links from favorites
     $lftab = new MenuItem('Links From Favorites', 'Links in posts you favorited', $twitter_data_tpl);
     $lftabds = new Dataset("links", 'LinkDAO', "getLinksByFavorites", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $lftabds->addHelp('userguide/listings/twitter/dashboard_links-favorites');
     $lftab->addDataset($lftabds);
     $menus["links-favorites"] = $lftab;
     //Photos
     $ptab = new MenuItem("Photos from People You Follow", 'Photos your friends have posted', $twitter_data_tpl);
     $ptabds = new Dataset("links", 'LinkDAO', "getPhotosByFriends", array($instance->network_user_id, 'twitter', 15, '#page_number#'));
     $ptabds->addHelp('userguide/listings/twitter/dashboard_links-photos');
     $ptab->addDataset($ptabds);
     $menus["links-photos"] = $ptab;
     return $menus;
 }
Ejemplo n.º 30
0
 /**
  * Get Dashboard menu
  * @param $instance Instance
  * @return array of MenuItem objects (Tweets, Friends, Followers, etc)
  */
 public function getDashboardMenuItems($instance)
 {
     // An array to store our list of menu items in
     $menus = array();
     // Set the view template to checkins.tpl
     $checkins_data_tpl = Utils::getPluginViewDirectory('foursquare') . 'checkins.tpl';
     // Add a checkins link to the list of pages on the left
     $checkins_menu_item = new MenuItem("Checkins", "Your checkins", $checkins_data_tpl);
     // Get the data for our checkins link
     $checkins_menu_ds_1 = new Dataset("all_checkins", 'PostDAO', "getAllCheckins", array($instance->network_user_id, $instance->network, 15, "#page_number#"));
     $checkins_menu_ds_1->addHelp('userguide/listings/foursquare/dashboard_posts');
     $checkins_menu_item->addDataset($checkins_menu_ds_1);
     // Add the checkins to our array of items
     $menus['posts'] = $checkins_menu_item;
     // Return the list of items we want to display
     return $menus;
 }