当前位置: 首页>>代码示例>>PHP>>正文


PHP Review::find方法代码示例

本文整理汇总了PHP中Review::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Review::find方法的具体用法?PHP Review::find怎么用?PHP Review::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Review的用法示例。


在下文中一共展示了Review::find方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createModel

 public function createModel()
 {
     $model = new Review();
     $criteria = new CDbCriteria();
     $criteria->select = array(new CDbExpression('MAX(sort) as sort'));
     $max = $model->find($criteria);
     $model->sort = $max->sort + 10;
     return $model;
 }
开发者ID:kuzmina-mariya,项目名称:gallery,代码行数:9,代码来源:ReviewBackendController.php

示例2: update

    public function update(){
        $input=Input::get();
        unset($input['_method']);
        unset($input['_token']);
        unset($input['submit']);
        $id = $input['id'];

        $review= Review::find($input['id']);
        $review->update($input);
        return Redirect::route('review_index');
    }
开发者ID:alur86,项目名称:PHP_Code_Samples,代码行数:11,代码来源:ReviewController.php

示例3: processreviewAction

 /**
  * Action that processes a review after submission
  * @author philipperigaux
  *
  */
 function processreviewAction()
 {
     if (!$this->config->isPhaseOpen(Config::REVIEWING_PHASE)) {
         $this->view->content = $this->texts->reviewer->review_phase_is_closed;
         echo $this->view->render("layout");
         return;
     }
     $this->view->setFile("content", "processreview.xml");
     $this->view->setBlock("content", "review");
     // Extract the block with marks.
     $this->view->set_block('review', "review_mark", "review_marks");
     // Extracts the block with answers
     $this->view->set_block('review', "review_answer", "review_answers");
     // Actions if the id of a paper is submitted
     if (isset($_REQUEST['idPaper'])) {
         $idPaper = $this->getRequest()->getParam("idPaper");
         $reviewTbl = new Review();
         $review = $reviewTbl->find($idPaper, $this->user->id)->current();
         // Check that the paper is REALLY assigned to the reviewer
         if (is_object($review)) {
             // Put the review in the database
             $review->updateFromArray($_POST);
             // Create the review presentation
             $this->view->review = $review->showReview($this->view, true);
             // Resolve the entities replacement
             $this->view->assign("content", "content");
             // Send a mail to confirm review submission
             $mail = new Mail(Mail::SOME_USER, $this->texts->mail->subj_ack_review, $this->view->getScriptPaths());
             $mail->setFormat(Mail::FORMAT_HTML);
             $mail->setTo($this->user->email);
             $mail->loadTemplate($this->lang, "ack_review");
             $mailViewEngine = $mail->getEngine();
             // Fixes a bug: the reviewer namespace is not present, and thus 'reviewer' texts
             // were not translated. NB: this requires a fix ubn Zmax_Translate_Db as well
             $this->texts->addTranslation($this->zmax_context->db, $this->zmax_context->locale, array("namespace" => 'reviewer', "view" => $mailViewEngine));
             $mailViewEngine->setBlock("template", "template_mark", "template_marks");
             $mailViewEngine->setBlock("template", "template_answer", "template_answers");
             $instantiatedMail = $review->showReview($mailViewEngine, true, "template");
             $mail->setTemplate($instantiatedMail);
             if ($this->config->mailOnReview == "Y") {
                 $mail->setCopyToChair(true);
             }
             $mail->send();
         } else {
             $this->view->content = $this->texts->def->access_denied;
         }
     } else {
         $this->view->content = "Invalid action<br/>";
     }
     echo $this->view->render("layout");
 }
开发者ID:camilorivera,项目名称:INNOVARE,代码行数:56,代码来源:ReviewerController.php

示例4: assignReviewers

 /**
  * Assign a list of reviewers to the paper
  */
 function assignReviewers($tabIds)
 {
     $reviewTbl = new Review();
     // Loop on the reviewers ids
     foreach ($tabIds as $id_user) {
         // Check whether the review exists
         $review = $reviewTbl->find($this->id, $id_user)->current();
         // Never delete! Just insert
         if (!is_object($review)) {
             $review = $reviewTbl->createRow();
             $review->idPaper = $this->id;
             $review->id_user = $id_user;
             $review->save();
         }
     }
 }
开发者ID:camilorivera,项目名称:INNOVARE,代码行数:19,代码来源:PaperRow.php

示例5: test_Find

 function test_Find()
 {
     //Arrange
     $beer_id = 1;
     $user_id = 1;
     $review = "Great beer";
     $date = "2015-10-08";
     $id = 3;
     $test_review = new Review($beer_id, $user_id, $review, $date, $id);
     $test_review->save();
     $beer_id = 2;
     $user_id = 2;
     $review = "Bad beer";
     $date = "2015-10-09";
     $id = 3;
     $test_review2 = new Review($beer_id, $user_id, $review, $date, $id);
     $test_review2->save();
     //Act
     $column_id = "review";
     $search_id = "Bad beer";
     $result = Review::find($column_id, $search_id);
     //Assert
     $this->assertEquals([$test_review2], $result);
 }
开发者ID:bborealis,项目名称:growler,代码行数:24,代码来源:ReviewTest.php

示例6: SummaryPapersAssignment


//.........这里部分代码省略.........
    // Manage the navigation table
    if ($nb_papers > MAX_ITEMS_IN_ASSIGNMENT or $nb_members > MAX_ITEMS_IN_ASSIGNMENT) {
        // Show the navigation table
        $tpl->set_var("nb_paper", $nb_papers);
        $tpl->set_var("nb_reviewers", $nb_members);
        $tpl->set_var("max_items_in_assignment", MAX_ITEMS_IN_ASSIGNMENT);
        if (isset($_REQUEST['i_paper_min'])) {
            // The request comes from the navigation table
            $i_paper_min = $_REQUEST['i_paper_min'];
            $i_paper_max = min($_REQUEST['i_paper_max'], $nb_papers);
            $i_member_min = $_REQUEST['i_member_min'];
            $i_member_max = min($_REQUEST['i_member_max'], $nb_members);
        } else {
            $i_paper_min = 1;
            $i_paper_max = min($nb_papers, MAX_ITEMS_IN_ASSIGNMENT);
            $i_member_min = 1;
            $i_member_max = min($nb_members, MAX_ITEMS_IN_ASSIGNMENT);
        }
        // Show the navigation table
        $tpl->set_var("NAV_TABLE", "");
        $lines = "";
        $script = $tpl->base_url . "/admin/chair/showassignment?1=1";
        for ($i = 1; $i <= $nb_papers; $i += MAX_ITEMS_IN_ASSIGNMENT) {
            $line = "";
            for ($j = 1; $j <= $nb_members; $j += MAX_ITEMS_IN_ASSIGNMENT) {
                $link = $script . "&i_paper_min={$i}" . "&i_paper_max=" . ($i + MAX_ITEMS_IN_ASSIGNMENT - 1) . "&i_member_min={$j}" . "&i_member_max=" . ($j + MAX_ITEMS_IN_ASSIGNMENT - 1);
                if ($i == $i_paper_min and $j == $i_member_min) {
                    $line .= "<td bgcolor=lightblue><a href='{$link}'>" . "<font color=white>{$i}/{$j}</font></a></td>";
                } else {
                    $line .= "<td><a href='{$link}'>{$i}/{$j}</a></td>";
                }
            }
            $lines .= "<tr>{$line}</tr>\n";
        }
        $tpl->set_var("NAV_TABLE", $lines);
        $tpl->append("NAVIGATION", "NAVIGATION_TABLE");
    } else {
        // Hide the navigation table
        $i_paper_min = $i_member_min = 1;
        $i_paper_max = $nb_papers;
        $i_member_max = $nb_members;
        $tpl->set_var("NAVIGATION", "");
    }
    // Put the current values in the template
    $tpl->set_var("I_PAPER_MIN", $i_paper_min);
    $tpl->set_var("I_PAPER_MAX", $i_paper_max);
    $tpl->set_var("I_MEMBER_MIN", $i_member_min);
    $tpl->set_var("I_MEMBER_MAX", $i_member_max);
    //  echo "I paper min=$i_paper_min I paper max = $i_paper_max<br>";
    // OK, now create the table. First the columns' headers
    for ($j = $i_member_min; $j <= $i_member_max; $j++) {
        $members[$j]->putInView($tpl);
        $tpl->member_nb_papers = $members[$j]->countPapers();
        $tpl->append("MEMBERS", "MEMBER_DETAIL");
    }
    // then each line
    $tpl->PAPERS = "";
    for ($i = $i_paper_min; $i <= $i_paper_max; $i++) {
        // Choose the CSS class
        if ($i % 2 == 0) {
            $tpl->set_var("css_class", "even");
        } else {
            $tpl->set_var("css_class", "odd");
        }
        $paper = $papers[$i];
        $entity = "Paper" . "->id";
        $tpl->setVar($entity, $papers[$i]->id);
        $tpl->SESSION_ID = session_id();
        // Get the ratings of each PC member
        $nbReviewers = 0;
        for ($j = $i_member_min; $j <= $i_member_max; $j++) {
            $member = $members[$j];
            $member->putInView($tpl);
            $rating = $ratingTbl->find($paper->id, $member->id)->current();
            if ($rating) {
                $val = $rating->rate;
            } else {
                $val = 2;
            }
            $tpl->bg_color = "white";
            $tpl->set_var("paper_rating", $val);
            $tpl->set_var("CHECKED_YES", "");
            $tpl->set_var("CHECKED_NO", "checked='1'");
            // Check if the paper is assigned
            $review = $reviewTbl->find($paper->id, $member->id)->current();
            if ($review) {
                $nbReviewers = $nbReviewers + 1;
                $tpl->bg_color = "yellow";
                $tpl->set_var("CHECKED_YES", "checked='1'");
                $tpl->set_var("CHECKED_NO", "");
            }
            // Add to the assignment line
            $tpl->append("ASSIGNMENTS", "ASSIGNMENT_DETAIL");
        }
        // Add to the list of papers
        $tpl->setVar("paper_nb_reviewers", $nbReviewers);
        $tpl->append("PAPERS", "PAPER_DETAIL");
        $tpl->set_var("ASSIGNMENTS", "");
    }
}
开发者ID:camilorivera,项目名称:INNOVARE,代码行数:101,代码来源:AdminLists.php

示例7: array

    $user = User::find("id", $user_id);
    $store = Store::find("id", $store_id);
    return $app['twig']->render('store.html.twig', array('store' => $store[0], 'user' => $user[0], 'beers' => $store[0]->getBeers(), 'all_beers' => Beer::getAll()));
});
//from store
//add beer to store
//show store
$app->post("/{user_id}/store/{store_id}", function ($user_id, $store_id) use($app) {
    $store = Store::find("id", $store_id);
    $beer = Beer::find("id", $_POST['beer_id']);
    $store[0]->addBeer($beer[0]->getId());
    $user = User::find("id", $user_id);
    return $app['twig']->render('store.html.twig', array('store' => $store[0], 'user' => $user[0], 'beers' => $store[0]->getBeers(), 'all_beers' => Beer::getAll()));
});
//--------------------------------------------- Begin Review Functionality ----------------------------------------
$app->get("/{user_id}/review/{beer_id}", function ($user_id, $beer_id) use($app) {
    $user = User::find("id", $user_id);
    $beer = Beer::find("id", $beer_id);
    return $app['twig']->render('review.html.twig', array('user' => $user[0], 'beer' => $beer[0]));
});
$app->post("/{user_id}/review/{beer_id}", function ($user_id, $beer_id) use($app) {
    $user = User::find("id", $user_id);
    $review = Review::findReview($beer_id, $user_id);
    $review[0]->update($_POST['beer_review'], $_POST['review_date']);
    $reviews = Review::find("user_id", $user[0]->getId());
    $new_beers = User::findBeerStyle($user[0]->getId(), $user[0]->getPreferredStyle());
    $local_stores = Store::find("region", $user[0]->getRegion());
    return $app['twig']->render('profile.html.twig', array('user' => $user[0], 'reviews' => $reviews, 'new_beers' => $new_beers, 'local_stores' => $local_stores));
});
return $app;
//End of app, do not code below here
开发者ID:bborealis,项目名称:growler,代码行数:31,代码来源:app.php

示例8: test_find

 function test_find()
 {
     //Arrange
     $rating = 1;
     $comment = "This place sucks!";
     $id = null;
     $test_review = new Review($rating, $comment, $id);
     $test_review->save();
     $rating2 = 2;
     $comment2 = "This place smells!";
     $id2 = null;
     $test_review2 = new Review($rating2, $comment2, $id2);
     $test_review2->save();
     //Act
     $result = Review::find($test_review2->getId());
     //Assert
     $this->assertEquals($test_review2, $result);
 }
开发者ID:jeffaustin81,项目名称:tinklr-dev,代码行数:18,代码来源:ReviewTest.php

示例9: paperstatusAction

 /**
  * Show the list of papers wit their status
  */
 function paperstatusAction()
 {
     $paperTbl = new Paper();
     $paperStatusTbl = new PaperStatus();
     $exportLatex = $exportExcel = false;
     if (isset($_REQUEST['export_latex'])) {
         $exportLatex = true;
         $this->view->message = "The LaTeX file <i>paperstatus.tex</i> has been generated in files/selection";
     }
     if (isset($_REQUEST['export_excel'])) {
         $exportExcel = true;
         $this->view->message = "The LaTeX file <i>paperstatus.tex</i> has been generated in files/selection";
     } else {
         $this->view->MESSAGE = "";
     }
     if (!$exportExcel) {
         $this->view->set_file("content", "paperstatus.xml");
         $this->view->set_block("content", "SELECTION_FORM");
         $this->view->set_block("content", "MESSAGE");
         $this->view->set_block("content", "SHOW_SELECTION_FORM");
         $this->view->set_file("ranked_papers_list", "ranked_papers.xml");
     } else {
         $this->view->set_file("ranked_papers_list", "paperstatus_excel.xml");
     }
     // Check whether the current selection must be changed
     if (isset($_POST['spStatus'])) {
         $this->config->changeCurrentSelection();
     }
     if (isset($_REQUEST['remove'])) {
         $reviewTbl = new Review();
         $review = $reviewTbl->find($_REQUEST['idPaper'], $_REQUEST['remove'])->current();
         if (is_object($review)) {
             $review->delete();
         }
     } else {
         if (isset($_REQUEST['idPaper'])) {
             // If the status is submitted: update in the DB
             $idPaper = $_REQUEST['idPaper'];
             $status = $_REQUEST['status'];
             foreach ($idPaper as $key => $val) {
                 if (isset($status[$val])) {
                     // echo "ID = $val<br/>";
                     $paper = $paperTbl->find($val)->current();
                     if (is_object($paper)) {
                         $paper->status = $status[$val];
                         $paper->save();
                     } else {
                         throw new Zmax_Exception("Unknown paper id sent to the change status function?");
                     }
                 }
             }
         }
     }
     // If required, hide the selection form
     if (isset($_REQUEST['hide_selection_form'])) {
         $this->config->show_selection_form = 'N';
         $this->config->save();
     } else {
         if (isset($_REQUEST['show_selection_form'])) {
             $this->config->show_selection_form = 'Y';
             $this->config->save();
         }
     }
     // Show the form for filtering papers, if required
     if ($this->config->show_selection_form == 'Y') {
         $this->view->set_var("FORM_SELECT_PAPERS", $this->formSelectPapers($this->view->base_url . "/admin/chair/paperstatus", $this->view, $this->db_v1));
         $this->view->set_var("SHOW_SELECTION_FORM", "");
     } else {
         $this->view->set_var("SELECTION_FORM", "");
     }
     // Create the list of lists to toggle all the selected papers
     $comma = $listLinks = "";
     $statusList = $paperStatusTbl->fetchAll("final_status='Y'");
     foreach ($statusList as $status) {
         $listLinks .= $comma . " <a href='#' onClick=\"TogglePaperStatus('{$status->id}')\">" . $status->label . "</a>";
         $comma = ",";
     }
     $this->view->set_var("TOGGLE_LIST", $listLinks);
     // Always list the papers
     if ($exportExcel) {
         $this->papersReviews($this->view, "ranked_papers_list", false);
     } else {
         $this->papersReviews($this->view, "ranked_papers_list");
     }
     // In addition, produce the Latex file
     if ($exportLatex) {
         $anonymized = false;
         if (isset($_REQUEST['anonymized'])) {
             $anonymized = true;
         }
         // Instantiate the data export object
         $dataExport = new DataExport($this->view->getScriptPaths());
         // Load the latex templates
         $dataExport->getView()->setFile("latex_papers_list", "paperstatus.tex");
         $this->papersReviews($dataExport->getView(), "latex_papers_list", false, $anonymized);
         // The directory where Latex files are produced
         $tex_dir = "selection/";
//.........这里部分代码省略.........
开发者ID:camilorivera,项目名称:INNOVARE,代码行数:101,代码来源:ChairController.php

示例10: GetByProductId

 public static function GetByProductId($productId)
 {
     return Review::find('all', array('product_id' => $productId));
 }
开发者ID:krasaler,项目名称:FamilyStore,代码行数:4,代码来源:ReviewService.php

示例11: Review

$review_id = 0;
$review = new Review();
try {
    $review_id = $review->create($fields);
    $success = true;
    $message = 'New review creation is complete.<br>';
    echo $message;
} catch (Exception $e) {
    $success = false;
    $message = $e->getMessage();
    echo "Creating a new review Error: " . $message . "<br>";
}
echo ($success == true ? "SUCCESS" : "FAILURE") . "<br>";
try {
    echo "<br>Testing find review:<br>";
    print_r("If found review:" . $review->find($review_id) . "<br>");
    print_r($review->get_review_info());
    echo "<br>";
    echo $review->get_review_info_json();
    echo "<br>";
} catch (Exception $e) {
    $success = false;
    $message = $e->getMessage();
    echo "Find review Error: " . $message . "<br>";
}
echo ($success == true ? "SUCCESS" : "FAILURE") . "<br>";
try {
    echo "<br>Testing for canceling a review : <br> review_id: {$review_id}<br>";
    echo "Result: " . $review->cancel($review_id) . "<br>";
} catch (Exception $e) {
    $success = false;
开发者ID:HuiSF,项目名称:FineTable-Class-Project,代码行数:31,代码来源:test-rsv-and-review.php

示例12: reviewEdit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function reviewEdit($id)
 {
     $review = Review::find($id);
     if (Auth::user()->usr_level == 2) {
         return view('reviews.edit', compact('review'));
     } else {
         return Redirect::to(Config::get('url.home'));
     }
 }
开发者ID:palhimanshu1991,项目名称:berdict,代码行数:15,代码来源:AdminController.php


注:本文中的Review::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。