Permalink
Browse files

jun09 branch

  • Loading branch information...
1 parent 0eb47e5 commit 345fb8030fe0835cd658767c2b32d426159ed1d9 Jeff Reifman committed Jun 9, 2009
Showing with 11,532 additions and 0 deletions.
  1. +178 −0 core/classes/forum.class.php
  2. +244 −0 core/classes/researchSurveyMonkey.class.php
  3. +1 −0 core/classes/subscriptions.class.php
  4. +31 −0 docs/approvedClouds.txt
  5. +38 −0 facebook/classes/autoPost.class.php
  6. +92 −0 facebook/pages/pageWall.class.php
  7. +32 −0 facebook/scripts/autoPost.js
  8. +29 −0 open-social-media-toolkit.tmproj
  9. +96 −0 php/console/controllers/admin_controller.php
  10. +75 −0 php/console/controllers/app_controller.php
  11. +90 −0 php/console/controllers/dashpods_controller.php
  12. +75 −0 php/console/controllers/facebook_controller.php
  13. +48 −0 php/console/controllers/main_controller.php
  14. +657 −0 php/console/controllers/members_controller.php
  15. +127 −0 php/console/controllers/settings_controller.php
  16. +15 −0 php/console/controllers/statistics_controller.php
  17. +606 −0 php/console/controllers/stories_controller.php
  18. +690 −0 php/console/controllers/street_team_controller.php
  19. +96 −0 php/console/filters.php
  20. +81 −0 php/console/helpers/application_helper.php
  21. BIN php/console/images/banner.jpg
  22. BIN php/console/loading_bar.gif
  23. +75 −0 php/console/models/BaseModel.php
  24. +15 −0 php/console/models/Log.php
  25. +15 −0 php/console/models/LogDumps.php
  26. +14 −0 php/console/models/OutboundMessages.php
  27. +14 −0 php/console/models/RawExtLinks.php
  28. +14 −0 php/console/models/SessionLengths.php
  29. +60 −0 php/console/models/Songs.php
  30. +14 −0 php/console/models/User.php
  31. +14 −0 php/console/models/UserInfo.php
  32. +40 −0 php/console/models/leads.php
  33. +1,594 −0 php/console/pods.js
  34. +112 −0 php/console/pods/ActionStats.php
  35. +104 −0 php/console/pods/AgeDistribution.php
  36. +184 −0 php/console/pods/BasePod.php
  37. +55 −0 php/console/pods/ChallengeChart.php
  38. +211 −0 php/console/pods/ChallengeReport.php
  39. +99 −0 php/console/pods/CityDistribution.php
  40. +81 −0 php/console/pods/CountryDistribution.php
  41. +85 −0 php/console/pods/EmailDistribution.php
  42. +85 −0 php/console/pods/GenderDistribution.php
  43. +75 −0 php/console/pods/InterestDistribution.php
  44. +100 −0 php/console/pods/MemberStats.php
  45. +92 −0 php/console/pods/MostDiscussedStories.php
  46. +91 −0 php/console/pods/MostReadStories.php
  47. +92 −0 php/console/pods/MostShared.php
  48. +72 −0 php/console/pods/SessionLengths.php
  49. +102 −0 php/console/pods/SessionStats.php
  50. +99 −0 php/console/pods/StateDistribution.php
  51. +25 −0 php/console/pods/Statistics.php
  52. +220 −0 php/console/pods/StoryReport.php
  53. +139 −0 php/console/pods/TopRatedStories.php
  54. +73 −0 php/console/pods/TotalMembers.php
  55. +413 −0 php/console/pods/UserReport.php
  56. +35 −0 php/console/readme.txt
  57. +15 −0 php/console/readme_indexes.txt
  58. +157 −0 php/console/roles.php
  59. +204 −0 php/console/utility_functions.php
  60. +46 −0 php/console/views/admin/cronjobs.php
  61. +3 −0 php/console/views/admin/index.php
  62. 0 php/console/views/dashpods/base_page.php
  63. +12 −0 php/console/views/facebook/downloadsettings.php
  64. +3 −0 php/console/views/facebook/index.php
  65. +43 −0 php/console/views/main/dashboard.php
  66. +6 −0 php/console/views/members/fields_forumtopic.php
  67. +42 −0 php/console/views/members/forumtopics.php
  68. +3 −0 php/console/views/members/index.php
  69. +38 −0 php/console/views/members/member_emails.php
  70. +75 −0 php/console/views/members/member_fields.php
  71. +61 −0 php/console/views/members/members.php
  72. +15 −0 php/console/views/members/modify_forumtopic.php
  73. +15 −0 php/console/views/members/modify_member.php
  74. +15 −0 php/console/views/members/modify_outboundmessage.php
  75. +13 −0 php/console/views/members/new_forumtopic.php
  76. +13 −0 php/console/views/members/new_member.php
  77. +13 −0 php/console/views/members/new_outboundmessage.php
  78. +59 −0 php/console/views/members/outboundmessage_fields.php
  79. +52 −0 php/console/views/members/outboundmessages.php
  80. +10 −0 php/console/views/members/send_outboundmessage.php
  81. +43 −0 php/console/views/members/show_friend_invite_credits.php
  82. +17 −0 php/console/views/members/view_forumtopic.php
  83. +252 −0 php/console/views/members/view_member.php
  84. +21 −0 php/console/views/members/view_member_email.php
  85. +61 −0 php/console/views/members/view_outboundmessage.php
  86. 0 php/console/views/pod.php
  87. +3 −0 php/console/views/settings/index.php
  88. +173 −0 php/console/views/settings/initialize_tables.php
  89. 0 php/console/views/settings/load_settings.php
  90. +46 −0 php/console/views/settings/new_pod.php
  91. +69 −0 php/console/views/statistics/base.php
  92. +3 −0 php/console/views/statistics/index.php
  93. +28 −0 php/console/views/stories/add_story_widget.php
  94. +27 −0 php/console/views/stories/comment_fields.php
  95. +45 −0 php/console/views/stories/comments.php
  96. +15 −0 php/console/views/stories/modify_comment.php
  97. +15 −0 php/console/views/stories/modify_story.php
  98. +15 −0 php/console/views/stories/modify_video.php
  99. +15 −0 php/console/views/stories/modify_widget.php
  100. +13 −0 php/console/views/stories/new_comment.php
  101. +13 −0 php/console/views/stories/new_story.php
  102. +13 −0 php/console/views/stories/new_video.php
  103. +13 −0 php/console/views/stories/new_widget.php
  104. +24 −0 php/console/views/stories/place_widget.php
  105. +52 −0 php/console/views/stories/story_fields.php
  106. +43 −0 php/console/views/stories/story_posts.php
  107. +8 −0 php/console/views/stories/video_fields.php
  108. +38 −0 php/console/views/stories/video_posts.php
  109. +39 −0 php/console/views/stories/view_comment.php
  110. +91 −0 php/console/views/stories/view_story.php
  111. +24 −0 php/console/views/stories/view_video.php
  112. +42 −0 php/console/views/stories/view_widget.php
  113. +55 −0 php/console/views/stories/widget_fields.php
  114. +53 −0 php/console/views/stories/widgets.php
  115. +56 −0 php/console/views/street_team/assign_prize.php
  116. +288 −0 php/console/views/street_team/award_prize.php
  117. +78 −0 php/console/views/street_team/challenge_detail_report.php
  118. +89 −0 php/console/views/street_team/challenge_fields.php
  119. +60 −0 php/console/views/street_team/challenges.php
  120. +39 −0 php/console/views/street_team/completed_challenge_fields.php
  121. +57 −0 php/console/views/street_team/completed_challenges.php
  122. +3 −0 php/console/views/street_team/index.php
  123. +78 −0 php/console/views/street_team/leaders.php
  124. +14 −0 php/console/views/street_team/modify_challenge.php
  125. +15 −0 php/console/views/street_team/modify_completed_challenge.php
  126. +15 −0 php/console/views/street_team/modify_order.php
  127. +14 −0 php/console/views/street_team/modify_prize.php
  128. +13 −0 php/console/views/street_team/new_challenge.php
  129. +13 −0 php/console/views/street_team/new_completed_challenge.php
  130. +13 −0 php/console/views/street_team/new_order.php
  131. +13 −0 php/console/views/street_team/new_prize.php
  132. +74 −0 php/console/views/street_team/order_fields.php
  133. +62 −0 php/console/views/street_team/orders.php
  134. +104 −0 php/console/views/street_team/prize_fields.php
  135. +67 −0 php/console/views/street_team/prizes.php
  136. +41 −0 php/console/views/street_team/view_challenge.php
  137. +134 −0 php/console/views/street_team/view_completed_challenge.php
  138. +35 −0 php/console/views/street_team/view_order.php
  139. +47 −0 php/console/views/street_team/view_prize.php
  140. +14 −0 sites/climate/facebook/templates/forum.php
@@ -0,0 +1,178 @@
+<?php
+
+// to do - UserForumTopics table
+// topic id, last visit
+// code to get topic list table for a specific user showing new posts since last visit
+
+require_once(PATH_CORE.'/classes/dbRowObject.class.php');
+class ForumTopics extends dbRowObject
+{
+
+}
+
+class ForumTopicsTable
+{
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////
+ // standard table fields
+ var $db;
+ static $tablename="ForumTopics";
+ static $idname = "id";
+ static $idtype = "INT(11) unsigned NOT NULL auto_increment";
+ static $dbRowObjectClass = "ForumTopics";
+
+ static $fields = array(
+ "title" => "VARCHAR(255) default ''",
+ "intro" => "TEXT default ''",
+ "lastChanged" => "DATETIME",
+ "numPostsToday" => "INT(4) default 0",
+ "numViewsToday" => "INT(4) default 0"
+ );
+
+ static $keydefinitions = array();
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////
+ // standard table functions
+ function __construct(&$db=NULL)
+ {
+ if (is_null($db))
+ {
+ require_once('db.class.php');
+ $this->db=new cloudDatabase();
+ } else
+ $this->db=$db;
+ }
+ // although many functions will be duplicated between table subclasses, having a parent class gets too messy
+ function getRowObject()
+ {
+ $classname = self::$dbRowObjectClass;
+ return new $classname($this->db, self::$tablename, array_keys(self::$fields), self::$idname);
+ }
+
+ // generic table creation routine, same for all *Table classes
+ static function createTable($manageObj)
+ {
+ $manageObj->addTable(self::$tablename,self::$idname,self::$idtype,"MyISAM");
+ foreach (array_keys(self::$fields) as $key)
+ {
+ $manageObj->updateAddColumn(self::$tablename,$key,self::$fields[$key]);
+ }
+ foreach (self::$keydefinitions as $keydef)
+ {
+ $manageObj->updateAddKey(self::$tablename,$keydef[0], $keydef[1], $keydef[2], $keydef[3]);
+ }
+ }
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ function testPopulate()
+ {
+
+ $Forum = $this->getRowObject();
+ $Forum->title = 'Rescue a cute animal from a politically incorrect predicament';
+ $Forum->pointValue = 100;
+ $Forum->dateStart = date('Y-m-d H:i:s', time());
+ if (!self::checkForumExistsByTitle($Forum->title)) $Forum->insert();
+
+ }
+
+
+ function checkForumExistsByTitle($title)
+ {
+
+ $chkDup=$this->db->queryC("SELECT ".self::$idname." FROM ".self::$tablename." WHERE title='$title'");
+ return $chkDup;
+
+ }
+
+};
+
+class Forums {
+
+ var $db;
+ var $templateObj;
+
+ function __construct(&$db=NULL)
+ {
+ if (is_null($db)) {
+ require_once('db.class.php');
+ $this->db=new cloudDatabase();
+ } else
+ $this->db=$db;
+ $this->setupLibraries();
+
+ }
+
+ function loadAndTouchForumTopic($id=0) {
+ $this->touchForumTopic($id);
+ $ftTable = new ForumTopicsTable($this->db);
+ $ft = $ftTable->getRowObject();
+ $ft->load($id);
+ return $ft;
+ }
+
+ function touchForumTopic($id=0) {
+ $this->db->update("ForumTopics","numViewsToday=numViewsToday+1","id=$id");
+ }
+
+ function setupLibraries() {
+ require_once(PATH_CORE.'/classes/template.class.php');
+ $this->templateObj=new template($this->db);
+ $this->templateObj->registerTemplates(MODULE_ACTIVE,'Forums');
+ }
+
+ function fetchForumList($sort, $currentPage=1)
+ {
+
+ $cacheName='chList_'.$sort.'_'.$currentPage;
+ if ($this->templateObj->checkCache($cacheName,15)) {
+ // still current, get from cache
+ $code=$this->templateObj->fetchCache($cacheName);
+ } else {
+ // to do - take out rows per page
+
+ $where= "WHERE status='enabled'";
+
+ if ($sort=='isFeatured')
+ $where.=' AND isFeatured=1';
+
+ if ($sort =='pointValue')
+ $sort = "$sort DESC";
+
+ $code='';
+ $rowsPerPage = 2*ROWS_PER_PAGE;
+ $startRow=($currentPage-1)*$rowsPerPage; // replace rows per page
+ $ForumList=$this->templateObj->db->query(
+ "SELECT SQL_CALC_FOUND_ROWS
+ thumbnail, title, pointValue, id,
+ MONTHNAME(dateStart) AS monthstart,
+ DAY(dateStart) AS daystart,
+ MONTHNAME(dateEnd) AS monthend,
+ DAY(dateEnd) AS dayend,description,
+ (CASE type WHEN 'automatic' THEN 'hidden'
+ WHEN 'submission' THEN ''
+ END) AS submissionStyle
+ FROM Forums $where ORDER BY type DESC, $sort LIMIT $startRow,".$rowsPerPage.";");
+
+ // to do - later we'll move these template defs
+ if ($this->templateObj->db->countQ($ForumList)>0)
+ {
+ $rowTotal=$this->templateObj->db->countFoundRows();
+ $pagingHTML=$this->templateObj->paging($currentPage,$rowTotal,$rowsPerPage,'&p=Forums&currentPage='); // later put back page->rowsPerPage
+ // $this->templateObj->db->setTemplate`('comments', array($this, 'decodeComment'), 'comments');
+ $this->templateObj->db->setTemplateCallback('pointValue', array($this, 'getPointValue'), 'pointValue');
+ //$code.=$this->templateObj->mergeTemplate($this->templateObj->templates['commentList'],$this->templateObj->templates['commentItem']);
+ $code.=$pagingHTML;
+ $code.=$this->templateObj->mergeTemplate($this->templateObj->templates[ForumPanelList],$this->templateObj->templates[ForumPanelItem]);
+ $code.=$pagingHTML;
+ } else {
+ $code.='No Forums found.';
+ }
+
+ $this->templateObj->cacheContent($cacheName,$code);
+ }
+ return $code;
+
+ }
+
+}
+
+?>
Oops, something went wrong.

0 comments on commit 345fb80

Please sign in to comment.