Esempio n. 1
0
File: Random.php Progetto: rjha/sc
 function process($params, $options)
 {
     $postDao = new \com\indigloo\sc\dao\Post();
     $total = $postDao->getTotalCount();
     $rows1 = $postDao->getRandom(25);
     $ids = array();
     for ($i = 1; $i <= 25; $i++) {
         $ids[] = mt_rand(1, $total - 1);
     }
     $rows2 = $postDao->getOnSearchIds($ids);
     $postDBRows = array_merge($rows1, $rows2);
     $pageHeader = '<a href="/surprise/me">Try again?</a>';
     $pageTitle = SeoData::getHomePageTitle();
     $metaDescription = SeoData::getHomeMetaDescription();
     $metaKeywords = SeoData::getHomeMetaKeywords();
     $file = APP_WEB_DIR . '/view/tiles.php';
     include $file;
 }
Esempio n. 2
0
File: Site.php Progetto: rjha/sc
 function process($params, $options)
 {
     if (is_null($params) || empty($params)) {
         $controller = new \com\indigloo\sc\controller\Http400();
         $controller->process();
         exit;
     }
     $siteId = Util::tryArrayKey($params, "site_id");
     $cname = Url::tryQueryParam("cname");
     if (empty($siteId) || empty($cname)) {
         $controller = new \com\indigloo\sc\controller\Http400();
         $controller->process();
         exit;
     }
     $siteDao = new \com\indigloo\sc\dao\Site();
     $postDBRows = $siteDao->getPostsOnId($siteId, 50);
     $pageHeader = $cname;
     $pageTitle = SeoData::getHomePageTitle();
     $metaDescription = SeoData::getHomeMetaDescription();
     $metaKeywords = SeoData::getHomeMetaKeywords();
     $file = APP_WEB_DIR . '/view/tiles.php';
     include $file;
 }
Esempio n. 3
0
File: User.php Progetto: rjha/sc
 private function processIndex($params, $options)
 {
     $pubUserId = Util::getArrayKey($params, "login_id");
     $loginId = PseudoId::decode($pubUserId);
     $qparams = Url::getRequestQueryParams();
     $gNumDBRows = array();
     //data:1:user
     $userDao = new \com\indigloo\sc\dao\User();
     $userDBRow = $userDao->getOnLoginId($loginId);
     $this->isValidUser($userDBRow);
     //data:2:counters
     $analyticDao = new \com\indigloo\sc\dao\Analytic();
     $ucounters = $analyticDao->getUserCounters($loginId);
     //data:3:items
     $postDao = new \com\indigloo\sc\dao\Post();
     $model = new \com\indigloo\sc\model\Post();
     $filters = array();
     $filter = new Filter($model);
     $filter->add($model::LOGIN_ID, Filter::EQ, $loginId);
     array_push($filters, $filter);
     $postDBRows = $postDao->getLatest(8, $filters);
     $gNumDBRows["items"] = sizeof($postDBRows);
     //data:social graph
     $socialGraphDao = new \com\indigloo\sc\dao\SocialGraph();
     $followers = $socialGraphDao->getFollowers($loginId, 5);
     $followings = $socialGraphDao->getFollowing($loginId, 5);
     $gNumDBRows["followers"] = sizeof($followers);
     $gNumDBRows["followings"] = sizeof($followings);
     $followerUIOptions = array("ui" => "feed", "more" => "#");
     $followingUIOptions = array("ui" => "feed", "more" => "#", "image" => false);
     //data:4:activity
     $activityDao = new \com\indigloo\sc\dao\Activity();
     $feedDataObj = $activityDao->getUserActivities($loginId, 20);
     // data:5:likes
     $bookmarkDao = new \com\indigloo\sc\dao\Bookmark();
     $model = new \com\indigloo\sc\model\Bookmark();
     $filters = array();
     $filter = new Filter($model);
     $filter->add($model::SUBJECT_ID_COLUMN, Filter::EQ, $loginId);
     array_push($filters, $filter);
     $filter = new Filter($model);
     $filter->add($model::VERB_COLUMN, Filter::EQ, AppConstants::LIKE_VERB);
     array_push($filters, $filter);
     $likeDBRows = $bookmarkDao->getLatest(8, $filters);
     $gNumDBRows["likes"] = sizeof($likeDBRows);
     //data:6:lists
     $listDao = new \com\indigloo\sc\dao\Lists();
     $listDBRows = $listDao->getLatestOnLoginId($loginId, 4);
     $gNumDBRows["lists"] = sizeof($listDBRows);
     $template = APP_WEB_DIR . '/view/user/pub.php';
     //page variables
     $pageBaseUrl = "/pub/user/" . $pubUserId;
     $pageTitle = SeoData::getHomePageTitle();
     $metaKeywords = SeoData::getHomeMetaKeywords();
     $metaDescription = SeoData::getHomeMetaDescription();
     include $template;
 }