Exemplo n.º 1
0
 function render_multi_editor($settings)
 {
     $multi_id = $settings["multi_id"] == 0 ? $this->g->o["mur_review_set"] : $settings["multi_id"];
     $post_id = $settings["post_id"];
     $init_votes = $settings["votes"];
     $set = gd_get_multi_set($multi_id);
     if (is_null($set)) {
         $set = gd_get_multi_set();
     }
     $multi_id = !is_null($set) ? $set->multi_id : 0;
     if ($multi_id > 0 && $post_id > 0) {
         $vote_id = GDSRDBMulti::get_vote($post_id, $multi_id, count($set->object));
         $multi_data = GDSRDBMulti::get_values($vote_id, 'rvw');
         if (count($multi_data) == 0) {
             GDSRDBMulti::add_empty_review_values($vote_id, count($set->object));
             $multi_data = GDSRDBMulti::get_values($vote_id, 'rvw');
         }
     } else {
         $multi_data = array();
     }
     $votes = array();
     if (count($multi_data) > 0) {
         foreach ($multi_data as $md) {
             $single_vote = array();
             $single_vote["votes"] = 1;
             $single_vote["score"] = $md->user_votes;
             $single_vote["rating"] = $md->user_votes;
             $votes[] = $single_vote;
         }
     } else {
         for ($i = 0; $i < count($set->object); $i++) {
             $iv = isset($init_votes[$i]) ? $init_votes[$i] : 0;
             $votes[] = array("votes" => $iv == 0 ? 0 : 1, "score" => $iv == 0 ? 0 : $iv, "rating" => $iv == 0 ? 0 : $iv);
         }
     }
     if ($settings["admin"]) {
         include $this->g->plugin_path . 'integrate/edit_multi.php';
     } else {
         return GDSRRenderT2::render_mre(intval($settings["tpl"]), array("post_id" => $settings["post_id"], "style" => $settings["style"], "height" => $settings["size"], "votes" => $votes, "set" => $set, "allow_vote" => true));
     }
 }
Exemplo n.º 2
0
        <input onclick="gdsrMultiClear(<?php 
    echo $multi_id;
    ?>
, <?php 
    echo $post_id;
    ?>
, <?php 
    echo count($set->object);
    ?>
)" type="button" class="gdsr-input-button" value="<?php 
    _e("Clear", "gd-star-rating");
    ?>
" />
        <input onclick="gdsrMultiRevert(<?php 
    echo $multi_id;
    ?>
, <?php 
    echo $post_id;
    ?>
, <?php 
    echo count($set->object);
    ?>
)" type="button" class="gdsr-input-button" value="<?php 
    _e("Revert", "gd-star-rating");
    ?>
" />
<?php 
    echo '</td><td width="65%" class="gdsr-mur-review-stars">';
    echo GDSRRenderT2::render_mre("oxygen", 0, true, $votes, $post_id, $set, 20);
    echo '</td></tr></table>';
}
Exemplo n.º 3
0
 /**
  * Renders multi rating review editor block.
  *
  * @param int $post_id id of the post to render review editor for
  * @param bool $admin wheter the rendering is for admin edit post page or not
  * @return string rendered result
  */
 function blog_multi_review_editor($post_id, $settings = array(), $admin = true, $allow_vote = true)
 {
     if ($settings["id"] == "") {
         $multi_id = $this->o["mur_review_set"];
     } else {
         $multi_id = $settings["id"];
     }
     $set = gd_get_multi_set($multi_id);
     if ($multi_id > 0 && $post_id > 0) {
         $vote_id = GDSRDBMulti::get_vote($post_id, $multi_id, count($set->object));
         $multi_data = GDSRDBMulti::get_values($vote_id, 'rvw');
         if (count($multi_data) == 0) {
             GDSRDBMulti::add_empty_review_values($vote_id, count($set->object));
             $multi_data = GDSRDBMulti::get_values($vote_id, 'rvw');
         }
     } else {
         $multi_data = array();
     }
     $votes = array();
     foreach ($multi_data as $md) {
         $single_vote = array();
         $single_vote["votes"] = 1;
         $single_vote["score"] = $md->user_votes;
         $single_vote["rating"] = $md->user_votes;
         $votes[] = $single_vote;
     }
     if ($admin) {
         include $this->plugin_path . 'integrate/edit_multi.php';
     } else {
         return GDSRRenderT2::render_mre("oxygen", intval($settings["tpl"]), $allow_vote, $votes, $post_id, $set, 20);
     }
 }
Exemplo n.º 4
0
        <input onclick="gdsrMultiClear(<?php 
    echo $multi_id;
    ?>
, <?php 
    echo $post_id;
    ?>
, <?php 
    echo count($set->object);
    ?>
)" type="button" class="gdsr-input-button" value="<?php 
    _e("Clear", "gd-star-rating");
    ?>
" />
        <input onclick="gdsrMultiRevert(<?php 
    echo $multi_id;
    ?>
, <?php 
    echo $post_id;
    ?>
, <?php 
    echo count($set->object);
    ?>
)" type="button" class="gdsr-input-button" value="<?php 
    _e("Revert", "gd-star-rating");
    ?>
" />
<?php 
    echo '</td><td width="65%" class="gdsr-mur-review-stars">';
    echo GDSRRenderT2::render_mre(0, array("post_id" => $post_id, "votes" => $votes, "style" => "oxygen", "set" => $set, "height" => 20, "allow_vote" => true));
    echo '</td></tr></table>';
}