コード例 #1
0
 public static function calcRecommendations($filename, $limit = false)
 {
     $f = fopen($filename, "w");
     $stubs = Recommendations::findStubs($limit);
     $r = new Recommendations();
     $r->excludeWorstRelated(250);
     $userScore = array();
     foreach ($stubs as $stub) {
         if ($stub) {
             $userScore = $r->getSuggestedUsers($stub);
             arsort($userScore);
             foreach ($userScore as $username => $score) {
                 if (Recommendations::isAvailableUser($username)) {
                     print wfTimestampNow() . " Adding recommendation to edit " . $stub->getText() . " for user " . $username . "\n";
                     $u = User::newFromId($username);
                     if ($u && $u->getId()) {
                         fwrite($f, $u->getId() . "\t" . $stub->getArticleId() . "\t" . $score);
                         $reasons = $r->getSuggestionReason($username, $stub->getArticleId());
                         foreach ($reasons as $reason) {
                             fwrite($f, "\t" . $reason);
                         }
                         fwrite($f, "\n");
                     }
                 }
             }
         }
     }
 }
コード例 #2
0
                                    <p style="text-align: justify">
                                    Recommendations control is used to show a list of interesting content for particular domain. The list is created depending on user personal preferences and
                                    shared content by other people. The example shows PHP code for creating the control with default setting: width 300 pixels, height 300 pixels, show header and
                                    light color scheme. Recommendations are set for faceconn.com domain.

                                    <br /><br />
                                    For all details about the control, with descriptions of all optional properties, please visit
                                    <b><a href="http://faceconn.com/facebook-recommendations-php">Facebook Recommendations Tutorial</a></b>.
                                    <br />
                                    </p>
                                    
                                    <?php 
// check facebook session
include 'SessionCheck.php';
// create new instance of the control
$recomendations = new Recommendations();
// set external domain
$recomendations->SetDomain("faceconn.com");
// render the control on the page
$recomendations->Render();
// render the control on the page
echo "<br /><br />";
include 'CodeExamples/RecommendationsExample.php';
?>
                                </td>
                            </tr>
                        </table>
                    </form>
                </td>
                <td style="width:20%"></td>
            </tr>
コード例 #3
0
 /**
  * Finds the Applyjobs model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Applyjobs the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Recommendations::findOne($id)) !== null) {
         return $model;
     } else {
         return false;
     }
 }