Thursday, October 31, 2013

Peer review (11) hide old review and awating approval from chair




http://localhost/education/peer_review/chair_manage_modules.php
 line 46 change
$modules = get_all_reviewed_modules();
to
$modules_reviewed = get_all_reviewed_modules();
foreach($modules_reviewed['in_review'] as $module2){
  $sql_2 ="SELECT review_done FROM cesei_review_done WHERE module_id=".$module2['module_id'];
  $result_2 = mysql_query($sql_2, $db);
  $review_done =mysql_result($result_2, 0);

  if($review_done==1) $modules['in_review'][] = $module2;
}
foreach($modules_reviewed['waiting_approval'] as $module2){
  $sql_2 ="SELECT review_done FROM cesei_review_done WHERE module_id=".$module2['module_id'];
  $result_2 = mysql_query($sql_2, $db);
  $review_done =mysql_result($result_2, 0);

  if($review_done==1) $modules['waiting_approval'][] = $module2;
}

foreach($modules_reviewed['complete'] as $module2){
  $sql_2 ="SELECT review_done FROM cesei_review_done WHERE module_id=".$module2['module_id'];
  $result_2 = mysql_query($sql_2, $db);
  $review_done =mysql_result($result_2, 0);

  if($review_done==1) $modules['complete'][] = $module2;
}

foreach($modules['waiting_approval'] as $module1){
  $sql_2 ="SELECT voting_method FROM cesei_review_done WHERE module_id=".$module1['module_id'];
  $result_2 = mysql_query($sql_2, $db);
  $voting_method =mysql_result($result_2, 0);
  $module_voting[$module1['module_id']] = $voting_method;
}

 bug:
 C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_templates\pr_chair_modules.tmpl.php

 line 319 change
if(count($this->modules['waiting']) > 0){
to
if(count($this->modules['waiting_approval']) > 0){

C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_templates\pr_admin_modules.tmpl.php
 line 338 change
if(count($this->modules['waiting']) > 0){
to
if(count($this->modules['waiting_approval']) > 0){

Peer Review: Move from development to cesei




File needed to be uploaded:
directory copy and update:
 education/peer_review,
 index.php, read_reviews_new.php, my_reviews.php, committee_meeting.php, chair_manage_modules.php, pr_reviews.php, pr_voting.php, pr_members_modules.php
chair_manage_members.php, read_reviews.php, deletemp3.php, simpleupload.php, review_form.php, displaymp3.php, simpleupload_form.php

 admin/edu
pr_manager.php, pr_read_reviews.php, pr_read_reviews_old.php, select_committee_members.php, pr_manager_new.php, pr_members.php, submit_randomize.php, pr_members_modules.php, submit_emailChair.php, pr_voting.php, add_review.php, submit_reviewDone.php, displaymp3.php, submit_undoreviewDone.php

_lib:
peer_review_tools.inc.php

_lib/peer_reviews_calls
move_to_approval.php, complete_review_process.php

_templates:
pr_review_form1.php, pr_my_reviews.tmpl.php, pr_my_reviews_old.tmpl.php, pr_review_modules.tmpl.php,  pr_chair_modules.tmpl.php, pr_admin_modules.tmpl.php, pr_admin_modules_new.tmpl.php, pr_read_reviews.tmpl.php, pr_all_modules.tmpl.php

_swf:
recorder.swf

n MySQL,create a new table cesei_review_done
CREATE TABLE  `cesei`.`cesei_review_done` (
   `module_id` mediumint(8) unsigned NOT NULL default '0',
   `creation_date` datetime NOT NULL default '0000-00-00 00:00:00',
   `review_done` mediumint(8) unsigned NOT NULL default '0',
   `email_chair` mediumint(8) unsigned NOT NULL default '0',
   `voting_method` mediumint(8) unsigned NOT NULL default '0',
   PRIMARY KEY  (`module_id`)
) ENGINE=MyISAM

Tuesday, October 29, 2013

Peer Review (10) - Revise after discussion




http://localhost/education/peer_review/my_reviews.php
 Merge  "review Process" and "In Progress" tab.
http://localhost/education/peer_review/my_reviews.php  and
http://localhost/education/peer_review/committee_meeting.php
Remove  "Modules in review" and "Committee members" tab.
 http://localhost/education/peer_review/my_reviews.php
line 25 change
  $sub_level_pages[1]  = Array('url'=>'reviews.php','title'=>'Modules In Review');
  $sub_level_pages[2]  = Array('url'=>'committee_meeting.php','title'=>'Committee Meeting');
  $sub_level_pages[3]  = Array('url'=>'members.php','title'=>'Committee Members');

to
    $sub_level_pages[1]  = Array('url'=>'committee_meeting.php','title'=>'Committee Meeting');

line 40 change
$my_reviews = get_my_reviewed_modules();
to
$my_reviews = get_my_reviewed_modules_new();
pr_my_reviews.tmpl.php
line 13, change
<?php if(count($this->my_reviews['in_progress']) > 0)
to
<?php if(count($this->my_reviews['in_progress']) > -100)
Remove line 18
<div id="mod-status-group-intro" style="display:none;">

move  line 45
<div id="mod-status-group-complete" style="display:none;">
to  line 18


line 135 change
$start_section = 'intro';
to
$start_section = 'in_progress';
line 22, 24,  97 and 98 add
 target="_blank"

C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_lib\peer_review_tools.inc.php
line 634 add:
function get_my_reviewed_modules_new(){
   global $db;
   $reviews = Array();
   $reviews['in_progress'] = array();
   $reviews['complete'] = array();
  
   $sql = "SELECT MUR.*,
                  UNIX_TIMESTAMP(MUR.date_assigned) AS date_assigned,
                  UNIX_TIMESTAMP(MUR.date_complete) AS date_complete,
                  MR.state,
                  MR.outcome,
                  C.title,C.hide
                  FROM cesei_module_user_reviews MUR
                  LEFT JOIN cesei_module_reviews MR ON MUR.module_id=MR.module_id
                  LEFT JOIN edu_courses C ON MUR.module_id=C.course_id
                  WHERE MUR.member_id=$_SESSION[member_id] ORDER BY C.title, MR.revision_cycle";
   $result = mysql_query($sql, $db);
   while($row = mysql_fetch_assoc($result)){
      if($row['state'] == 'complete'){
         $reviews['complete'][] = $row;
      }else{
         $reviews['in_progress'][] = $row;
      }
   }
   return $reviews;
}


New file:
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\education\peer_review\read_reviews_new.php
pr_review_form1.tmpl.php
change my vote, my recording, my comments

Merge: in progress and complete, open mp3 in new page

C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\education\peer_review\index.php
remove Modules In Review and committee members

C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_lib\peer_review_tools.inc.php
line 902 change (for no email notification)
     if($row['email'] != MAIL_DEFAULT){
to
       if(2<1){

Monday, October 28, 2013

Peer Review (9) Peer review for chair session




http://localhost/education/peer_review/index.php
Add a special link for peer review committee chair.
line 26 add:
$chair_page ='<li>Manage Peer Reviews for Chair
                <ul> <li><a href="chair_manage_members.php">Manage committee members and voting methods</a></li>
                     <li><a href="chair_manage_modules.php">View reviews and approve modules</a></li>
                </ul>
             </li>';

line 31 change
$page_content  .= '<ol>
to
$page_content  .= '<ol>'.$chair_page.'

Copy http://localhost/admin/edu/select_committee_members.php
to education/peer_review/chair_manage_members.php  and modify
line 14
validate_cesei_access(STATUS_ADMIN);
change to line 25:
$access = validate_pr_access(false);
if($access!='chair') {
 echo '<div id="system-message"><div id="error">
    <h4>The following errors have occured:</h4>
                <ul>
                    <li>only chair can access this page</li>
                </ul>
    </div></div>';
exit;
}


line 47 add (and C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\admin\edu\pr_manage.php, line 48)
foreach($modules['waiting_approval'] as $module1){
  $sql_2 ="SELECT voting_method FROM cesei_review_done WHERE module_id=".$module1['module_id'];
  $result_2 = mysql_query($sql_2, $db);
  $voting_method =mysql_result($result_2, 0);
  $module_voting[$module1['module_id']] = $voting_method;
}
$savant->assign('module_voting', $module_voting); 

Copy http://localhost/admin/edu/pr_members_modules.php 
to education/peer_review and modify as above

Copy http://localhost/admin/edu/pr_voting.php 
to education/peer_review and modify as above

Copy /admin/edu/pr_manage.php
/education/peer_review/chair_manage_modules.php and modify

copy pr_admin_modules.tmpl.php to pr_chair_modules.tmpl.php
Copy /admin/edu/pr_read_reviews.php
/education/peer_review/pr_read_reviews.php

 C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_lib\peer_review_calls\complete_review_process.php
line 43 add
      if($_POST['peer_review'] == 'yes'){
         header('Location: /education/peer_review/chair_manage_modules.php?ss='.$_POST['ss']);
         exit;
       }

 C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_templates\pr_chair_modules.tmpl.php (C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_templates\pr_admin_modules.tmpl.php, line 84)
line 81 add:
         <?php
             if($this->module_voting[$module['module_id']]==1) {echo "The voting method to approve  the module is online. It is recommended that you use <a href='/education/peer_review/committee_meeting.php' target='_blank'> committee meeting room </a>to approve the module.";}
             else {echo "Offline voting";}
         ?>

line 37 and 89 add
                     <input type="hidden" name="peer_review" value="yes" />
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_lib\peer_review_calls\move_to_approval.php
line 37 add:
     if($_POST['peer_review'] == 'yes'){
         header('Location: /education/peer_review/chair_manage_modules.php?ss=waiting');
         exit;
       }

Friday, October 25, 2013

Oct 28-Nov 2, 2013: Peer Review (8) From Under review to wating for approval




Combe back for dealing with how to approve module for committee chair and admin.
How to push to approval status and comments,
1) System admin: under review,add button "Submit button for approval"
after  some limit, the committee chair or admin move under review to  "waiting for approval"
 C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_templates\pr_admin_modules.tmpl.php
line 112 remove:
 <td><a href="pr_read_review.php?review_id=<?php echo($review['review_id']); ?>&ss=waiting">Read Review</a>
                     <?php
                        if($review['is_complete'] == 1){
                           echo('*');
                        }else{
                            if($review['date_complete'] == 0){
                             echo('<span class="error">***</span>');
                           }else{
                             echo('<span class="error">**</span>');
                           }
                        }
                     ?>
                     </td>.


line 169 change
       if($complete_count >0){ ?>
to
       if($complete_count >-100){ ?>
remove email notification when module is move to "waiting for approval"
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_lib\peer_review_calls\move_to_approval.php
line 28 change
        submit_module_for_approval($module_id,$revision_cycle,true);
to
        submit_module_for_approval($module_id,$revision_cycle,false);
line 38, change
        header('Location: /admin/edu/pr_manage.php?ss='.$_POST['ss']);
to
           header('Location: /admin/edu/pr_manage.php?ss=waiting');

Peer review (7) - randomize reviewers




C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\admin\edu\pr_manage_new.php
line 70
function submitRandomize(){
   document.forms['revisons'].action = 'submit_randomize.php';
   document.forms['revisons'].submit();
}

line 160 change
                    <input type="submit" class="input-button" name="emailChair" value="Email notification to committee chair" <?php if(($review_result ==0)||($email_chair==1))
                        echo 'disabled="disabled"'; ?> onclick="submitChair()"/>

 to
                        <input type="hidden" class="input-button" name="emailChair" value="Email notification to committee chair" <?php if(($review_result ==0)||($email_chair==1))
                        echo 'disabled="disabled"'; ?> onclick="submitChair()"/>
                        <input type="submit" class="input-button" name="randomize" value="Randomize committee and Email notification" <?php if(($review_result ==0)||($email_chair==2))
                        echo 'disabled="disabled"'; ?> onclick="submitRandomize()"/>


 C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_lib\peer_review_tools.inc.php
The module author can not review his module, Chair has to be in the review committee.
If the Chair has his modules reviewed,  he can review the module.
line 964 add:
function get_pr_members_random($module_id){
   global $db;
   $members = Array();
    $sql = "SELECT member_id FROM edu_courses WHERE course_id=$module_id";
   $result = mysql_query($sql,$db);
   if($row = mysql_fetch_assoc($result)){
      $owner_id = $row['member_id'];
   }
   $sql = "SELECT M.member_id, M.prefix, M.first_name, M.last_name, M.email, RC.is_chair FROM cesei_module_review_committee RC LEFT JOIN cesei_members M ON RC.member_id = M.member_id WHERE RC.is_chair=1";
   $result = mysql_query($sql, $db);
   while($row = mysql_fetch_assoc($result)){
      $row['full_name'] = trim(htmlspecialchars($row['prefix'].' '.$row['first_name'].' '.$row['last_name']));
      $members[$row['member_id']] = $row;
   }
   $sql = "SELECT M.member_id, M.prefix, M.first_name, M.last_name, M.email, RC.is_chair FROM cesei_module_review_committee RC LEFT JOIN cesei_members M ON RC.member_id = M.member_id WHERE RC.is_chair!=1 AND M.member_id!=$owner_id ORDER BY RAND()
    LIMIT 4";

   $result = mysql_query($sql, $db);
   while($row = mysql_fetch_assoc($result)){
      $row['full_name'] = trim(htmlspecialchars($row['prefix'].' '.$row['first_name'].' '.$row['last_name']));
      $members[$row['member_id']] = $row;
   }  
   return $members;
}

copy submit_emailChair.php to submit_randomize.php and modify

Module submission only send email to MAIL_CESEI_ADMIN  in
function submit_module_for_review($module_id){
in  C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_lib\peer_review_tools.inc.php

Peer review (6)




http://localhost/education/peer_review/reviews.php
Change
 2 reviewer(s) have not yet finished their review.
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_templates\pr_all_modules.tmpl.php,
line 163 and line 275
Change
         <div class="module-link error"><?php echo($incomplete_count); ?> reviewer(s) are still reviewing this module.</div>
          <?php if($incomplete_count > 0){ ?>
               <?php if($_SESSION['member_id'] != $module['member_id']){ ?>
                  <div class="module-reviewers">
                  <?php foreach($incompletes as $review){ ?>
                  - <a href="mailto:<?php echo($review['email']); ?>"><?php echo($review['reviewer']); ?></a><br />
                  <?php } ?>
                  </div>
               <?php } ?>
          <?php } ?>
          <?php if($not_started_count > 0){ ?>
            <div class="module-link error"><?php echo($not_started_count); ?> reviewer(s) did not conduct a review.</div>
               <?php if($_SESSION['member_id'] != $module['member_id']){ ?>
                  <div class="module-reviewers">
                  <?php foreach($not_started as $review){ ?>
                  - <a href="mailto:<?php echo($review['email']); ?>"><?php echo($review['reviewer']); ?></a><br />
                  <?php } ?>
                  </div>
               <?php } ?>
          <?php } ?>

to
          <?php if(($not_started_count+$incomplete_count) > 0){ ?>
            <div class="module-link error"><?php echo($not_started_count+$incomplete_count); ?> reviewer(s) have not finished their review.</div>
               <?php if($_SESSION['member_id'] != $module['member_id']){ ?>
                  <div class="module-reviewers">
                  <?php foreach($not_started as $review){ ?>
                  - <a href="mailto:<?php echo($review['email']); ?>"><?php echo($review['reviewer']); ?></a><br />
                  <?php } ?>
                             <?php foreach($incompletes as $review){ ?>
                  - <a href="mailto:<?php echo($review['email']); ?>"><?php echo($review['reviewer']); ?></a><br />
                  <?php } ?>
                  </div>
               <?php } ?>
          <?php } ?>

Thursday, October 24, 2013

peer review (5) - display review result and reviewers




http://localhost/education/peer_review/reviews.php
1) New reviewers not shown in review tab
cesei_new1.cesei_module_user_reviews
change revision_cycle from 0 to 1
module owner can not see the reviewer  name,
add only admin can see the reviewer name
 C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_templates\pr_all_modules.tmpl.php
line 102 and 210 add:
            $complete_count_no   = 0;
            $complete_count_abstain   = 0;

line 107 and line 217:
        $completes_no = array();
        $completes_abstain = array();


line 133 and 245 change to
      <div class="module-link"><?php echo($complete_count); ?> reviewer(s) vote yes and believe it is complete.</div>
         <?php if(($complete_count > 0)&&is_admin()){ ?>
               <?php if($_SESSION['member_id'] != $module['member_id']){ ?>
                  <div class="module-reviewers">
                  <?php foreach($completes as $review){ ?>
                  - <a href="mailto:<?php echo($review['email']); ?>"><?php echo($review['reviewer']); ?></a><br />
                  <?php } ?>
                  </div>
                  <?php } ?>
          <?php } ?>
          <div class="module-link"><?php echo($complete_count_no); ?> reviewer(s) vote no.</div>
         <?php if(($complete_count_no > 0)&&is_admin()){ ?>
               <?php if($_SESSION['member_id'] != $module['member_id']){ ?>
                  <div class="module-reviewers">
                  <?php foreach($completes_no as $review){ ?>
                  - <a href="mailto:<?php echo($review['email']); ?>"><?php echo($review['reviewer']); ?></a><br />
                  <?php } ?>
                  </div>
                  <?php } ?>
          <?php } ?>
          <div class="module-link"><?php echo($complete_count_abstain); ?> reviewer(s) vote abstain.</div>
         <?php if(($complete_count_abstain > 0)&&is_admin()){ ?>
               <?php if($_SESSION['member_id'] != $module['member_id']){ ?>
                  <div class="module-reviewers">
                  <?php foreach($completes_abstain as $review){ ?>
                  - <a href="mailto:<?php echo($review['email']); ?>"><?php echo($review['reviewer']); ?></a><br />
                  <?php } ?>
                  </div>
                  <?php } ?>
          <?php } ?>        


line 300
change
         <div class="error">No reviewers assigned</div>
to
          <div class="error"></div>

Modify
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\education\peer_review\read_reviews.php and
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\admin\edu\pr_read_reviews.php
line 28 change
$module_id      = intval($_GET['module']);
$revision_cycle = intval($_GET['cycle']);

to
$module_id      = intval($_REQUEST['module']);
$revision_cycle = intval($_REQUEST['cycle']);
$sql = "SELECT  * FROM  cesei_review_new WHERE module_id=".$module_id." ORDER BY email ASC";


$result = mysql_query($sql,$db);
$review_data=Array();
$review_display=Array();
 while($row_1 = mysql_fetch_assoc($result)) {
    $review_data[] = $row_1;
 }

if (isset($_POST["display"])) {
     if(!empty($_POST['rid'])) {

        $sql = "SELECT  * FROM  cesei_review_new WHERE id=".$_POST['rid'];
        $result = mysql_query($sql,$db);
        while($row= mysql_fetch_assoc($result)) {
             $review_display[] = $row;
         }
    }   
 }
$savant->assign('review_data', $review_data); 
$savant->assign('review_display', $review_display);
$savant->assign('module_id', $module_id);

 C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_templates\pr_admin_modules.tmpl.php
line 172 remove
 <td>&nbsp;&nbsp;<a href="pr_read_review.php?review_id=<?php echo($review['review_id']); ?>&ss=review">Read Review</a> |&nbsp;</td>
               <td>
               <form name="form-review-<?php echo($review['member_id']); ?>-<?php echo($review['module_id']); ?>-<?php echo($review['revision_cycle']); ?>" method="post" action="/_lib/peer_review_calls/remove_reviewer.php">
                  <input type="hidden" name="ss" value="review" />
                  <input type="hidden" name="access_point" value="admin" />
                  <input type="hidden" name="reviewer_id" value="<?php echo($review['member_id']); ?>" />
                  <input type="hidden" name="module_id" value="<?php echo($review['module_id']); ?>" />
                  <input type="hidden" name="revision_cycle" value="<?php echo($review['revision_cycle']); ?>" />
                  <a href="#Remove" onclick="document.forms['form-review-<?php echo($review['member_id']); ?>-<?php echo($review['module_id']); ?>-<?php echo($review['revision_cycle']); ?>'].submit(); return false;">Remove</a> |&nbsp;
               </form>
               </td>
               <?php if($review['is_complete'] == 1){ ?>
               <td>This reviewer is satisfied with the module and believes it is complete.</td>
               <?php }else{
                        if($review['date_complete'] == 0){
                          echo('<td class="error">This reviewer has not started their review.</td>');
                        }else{
                          echo('<td class="error">This reviewer is still reviewing the module.</td>');
                        }
                     } ?>

C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_templates\pr_read_reviews.tmpl.php
line 149  add (only admin can see the reviewer name)
  if(is_admin()) $full_name = trim($review['prefix'].' '.$review['first_name'].' '.$review['last_name']);
          
            $i=$i+1;
             echo('<h3 class="flush-bottom">Comments from reviewer '.$i.': '.$full_name.'</h3> ');


 C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_lib\peer_review_tools.inc.php
line 753 change
   $sql = "SELECT URD.*,UR.*,RE.*,
                  UNIX_TIMESTAMP(UR.date_assigned) AS date_assigned,
                  UNIX_TIMESTAMP(UR.date_complete) AS date_complete,
                  UR.review_id AS review_id                  FROM cesei_module_user_reviews UR
                  LEFT JOIN cesei_module_user_review_data URD ON UR.review_id=URD.review_id
                  LEFT JOIN cesei_module_user_rebuttal_data RE ON UR.review_id=RE.review_id
                  WHERE UR.module_id=$module_id
                  ORDER BY UR.date_assigned";

to
   $sql = "SELECT URD.*,UR.*,RE.*,
                  UNIX_TIMESTAMP(UR.date_assigned) AS date_assigned,
                  UNIX_TIMESTAMP(UR.date_complete) AS date_complete,
                  UR.review_id AS review_id, M.prefix,M.first_name,M.last_name
                  FROM cesei_module_user_reviews UR
                  LEFT JOIN cesei_module_user_review_data URD ON UR.review_id=URD.review_id
                  LEFT JOIN cesei_module_user_rebuttal_data RE ON UR.review_id=RE.review_id
                  LEFT JOIN cesei_members M ON UR.member_id=M.member_id
                  WHERE UR.module_id=$module_id
                  ORDER BY UR.date_assigned"; 

Monday, October 21, 2013

Peer review (4)




In http://localhost/admin/edu/pr_manage.php, hide add reviewers session
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_templates\pr_admin_modules.tmpl.php
line 215, 268 add:
   <div style="display:none;">
line 248, 302 add
   </div>
(remove the content inside display:none div)
http://localhost/education/peer_review/review_form.php?review_id=116&ss=in_progress
MySQL database, cesei_new1.cesei_module_user_reviews
redefine is_complete:
0 - under review
1 - yes
2 - no
3 - abstain

Modify
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\education\peer_review\review_form.php
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_templates\pr_review_form.tmpl.php

 create three new files under
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\education\peer_review
 deletemp3.ph, displaymp3.php, simpleupload.php

online audio recording, check moodle audio recording plugin:
https://moodle.org/plugins/pluginversions.php?plugin=assignment_onlineaudio
unzip and get onlineaudio folder copy it to C:\Users\jiansen\Desktop\CAS\jiansen_dir\moodle\moodle\mod\assignment\type
run http://localhost:8087/admin/index.php
upgrade
site admin, turn edit on
in add an activity,  under assignment, add an audi recording
Download pRecordTest from
http://flash-communications.net/sourcecode/index.html

AT_CONTENT_DIR, for example  C:\LMS_CESEI\file_repository\
create folder peer_review

Friday, October 18, 2013

peer review (3)




C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\admin\edu\pr_members_modules.php for editing committee members for chair.
<?php
 define('PORTAL_ID', 0); ?>
<?php require_once($_SERVER['DOCUMENT_ROOT'].'/_includes/cesei_globals.inc.php');
      validate_cesei_access(STATUS_ADMIN);

require_once($_SERVER['DOCUMENT_ROOT'].'/_lib/peer_review_tools.inc.php');
$savant->assign('section_title', 'CESEI Administration');
$savant->assign('section_href', '/admin/');
$savant->assign('page_title', 'Review Committee');

$savant->assign('path', Array(Array('url'=>'index.php','title'=>'Education Administration')) );

$sub_level_pages = Array();
$sub_level_pages[0]  = Array('url'=>'select_committee_members.php','title'=>'Select committee members for modules');
$back_to_page = Array('url'=>$_PORTALS[PORTAL_ID]['root'].'/admin/edu/','title'=>'Educational Administration');

$savant->assign('sub_level_pages', $sub_level_pages);
$savant->assign('back_to_page', $back_to_page);
$savant->assign('extra_hdr_tags', '<link rel="stylesheet" type="text/css" media="screen" href="/_css/peer_review.css" />');
if(!isset($_POST['module_id'])){
  $msg->addFeedback('You need to select a module');
  header('Location: select_committee_members.php');
  exit;
} else{
  $module_id = $_POST['module_id'];
}

$sql0 = "SELECT  title FROM edu_courses WHERE course_id=".$module_id;
$result0 = mysql_query($sql0,$db);
$module_title =mysql_result($result0, 0);
if(isset($_POST['remove'])){
   if(!isset($_POST['member_id'])){
     $msg->addFeedback('You need to select a member');
   } else{
   $member_id = intval($_POST['member_id']);
   $sql = "DELETE FROM cesei_module_user_reviews WHERE member_id=$member_id AND module_id=$module_id";
   @mysql_query($sql, $db);
   $msg->addFeedback('Member successfully removed');
   }
}
  $sql = "SELECT member_id FROM edu_courses WHERE course_id=$module_id";
   $result = mysql_query($sql,$db);
   if($row = mysql_fetch_assoc($result)){
      $owner_id = $row['member_id'];
   }
if(isset($_POST['add'])){
 
   foreach($_POST['users'] as $user){
      if($user==$owner_id){
          $msg->addWarning('Module owners cannot be set to review their own module.');
          continue;
      }
      $date_assigned  = date('Y-m-d');
      $sql0="SELECT * FROM cesei_module_user_reviews WHERE member_id=$user AND module_id=$module_id";
 
       $result0 = mysql_query($sql0, $db);
       $num_rows = mysql_num_rows($result0);
  
      if($num_rows<1){
         $sql = "INSERT INTO cesei_module_user_reviews (review_id, member_id, module_id, revision_cycle, is_complete,date_assigned, date_complete) VALUES ('','$user','$module_id',1,'','$date_assigned',  '')";
          @mysql_query($sql, $db);
          $msg->addFeedback('Committee members successfully added');
        } 
    }
}

if(isset($_POST['add_with_email'])){
 
   foreach($_POST['users'] as $user){
      if($user==$owner_id){
          $msg->addWarning('Module owners cannot be set to review their own module.');
          continue;
      }
      $date_assigned  = date('Y-m-d');
      $sql0="SELECT * FROM cesei_module_user_reviews WHERE member_id=$user AND module_id=$module_id";
 
       $result0 = mysql_query($sql0, $db);
       $num_rows = mysql_num_rows($result0);
  
      if($num_rows<1){
          include($_SERVER['DOCUMENT_ROOT'].'/_includes/email_content.inc.php');
          $sql    = "SELECT prefix, first_name, last_name, email FROM cesei_members  WHERE member_id=".$user;

          $result    = mysql_query($sql, $db);
          while($row = mysql_fetch_assoc($result)){
             $reviewer = trim(htmlspecialchars($row['prefix'].' '.$row['first_name'].' '.$row['last_name'])).'  ';
             $email = $row['email'];
          }
          $mail = new PHPMailer();
          $mail->AddAddress($email);
  
          $mail->Subject = "CESEI Peer Review assignment request";
            $_mail_body ="Dear ".$reviewer.",

            The ".INSTITUTION_SHORT_NAME."  Education Committee has requested your peer evaluation of the module %1s.
                Please log-in to ".INSTITUTION_SHORT_NAME."'s peer review area for further details and to access the evaluation form. If you are unable to conduct the review please contact CESEI and let us know.

            http://".$_SERVER_NAME."/education/peer_review/";
            $_mail_body ="test";
           $mail->Body    = vsprintf($_mail_body.$_mail_cesei_ftr.$_mail_inquiry_ftr,$module_title);
          if(!$mail->Send()) {
                  $msg->addError('There was an error sending the email message. Please try again in a few minutes.');
           }
       else{
            $msg->addFeedback('Email to '.$reviewer.' is sent.');
        }
        unset($mail);

         $sql = "INSERT INTO cesei_module_user_reviews (review_id, member_id, module_id, revision_cycle, is_complete,date_assigned, date_complete) VALUES ('','$user','$module_id','','','$date_assigned',  '')";
          @mysql_query($sql, $db);
          $msg->addFeedback('Committee members successfully added');
        } 
    }
}



$committee_members = get_pr_members();
$mail_all = Array();

$savant->display('document_top.tmpl.php'); 
echo '<p>'.$module_title.'</p>';
?>

   <form name="form" method="post" action="<?php echo($_SERVER['PHP_SELF']); ?>">
   <div class="input-form">
   <table summary="" class="data" rules="cols"><thead>
      <tr>
         <th>&nbsp;</th>
         <th>Committee Member</th>
         <th>Email</th>
         <th>&nbsp;</th>
      </tr>
   </thead>
   <tbody>
   <?php
      $selected_members = Array();
        $page_content = '';
           $sql = "SELECT
                  M.member_id, M.prefix, M.first_name, M.last_name, M.email
                  FROM cesei_module_user_reviews MUR
                  LEFT JOIN cesei_members M ON MUR.member_id=M.member_id WHERE MUR.module_id=".$module_id ;
        $result = mysql_query($sql, $db);
   
        while($member = mysql_fetch_assoc($result)){
            $selected_members[$member['member_id']] = $member['member_id'];
           $reviewer = trim(htmlspecialchars($member['prefix'].' '.$member['first_name'].' '.$member['last_name'])).'  ';
           $page_content .= '<tr onmousedown="document.form[\'m'.$member['member_id'].'\'].checked = true; rowselect(this);" id="r_'.$user['member_id'].'">
                         <td><input type="radio" name="member_id" value="'.$member['member_id'].'" id="m'.$member['member_id'].'" /></td>
                     <td>'.$reviewer.'</td><td><a href="mailto:'.$member['email'].'">'.$member['email'].'</a></td><td>';
            $sql0 = "SELECT is_chair FROM cesei_module_review_committee  WHERE member_id=".$member['member_id'];
            $result0 = mysql_query($sql0,$db);
              $is_chair =mysql_result($result0, 0);
            if($is_chair == 1){
                $page_content .= 'Committee Chair';
            }else{
               $page_content .= '&nbsp;';
            }
           $page_content .= '</td></tr>';
            $mail_all[] = $member['email'];
        }
         echo($page_content);
   ?>
   </tbody>
   <tfoot>
       <tr>
           <td colspan="4"><input type="submit" class="input-button" name="remove" value="Remove" />
                             
       </tr>
      <tr>
           <td colspan="4" style="background:none;">
          <a href="mailTo:<?php echo(implode(',',$mail_all)); ?>"><strong>Email all members of the committee</strong></a>
         </td>
       </tr>
    </tfoot>
   </table>
   <?php
       $sql = "SELECT  M.member_id, M.prefix, M.first_name, M.last_name, M.email
                  FROM cesei_module_review_committee MUR
                  LEFT JOIN cesei_members M ON MUR.member_id=M.member_id " ;
      
   $result = mysql_query($sql, $db);
   $member_select = '';
   while($row = mysql_fetch_assoc($result)){
        if($selected_members[$row['member_id']]){
         continue;
      }
      $member_select .= '<option value="'.$row['member_id'].'">'.trim(htmlspecialchars($row['prefix'].' '.$row['first_name'].' '.$row['last_name'])).'</option>';
   }
   ?>
   <h2 class="flush-bottom">Add Committee Members</h2>
      <div class="row clear-after">
         <select class="select-trans" name="users[]" id="users"  multiple="multiple" size="10">
         <?php echo($member_select);?>
         </select>
         <input type="hidden" name="module_id" value=<?php echo $_POST['module_id']; ?> />
      </div>
     
      <div class="row clear-after">
       <input type="submit" class="input-button" name="add_with_email" value="Add Committee Members with Email Notification" />
         <input type="submit" class="input-button" name="add" value="Add Committee Members without Email Notification" />
      </div>
   </div>
</form>
<?php $savant->display('document_bottom.tmpl.php'); ?> 


C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\admin\edu\pr_voting.php
for edit voting method:
 <?php
 define('PORTAL_ID', 0); ?>
<?php require_once($_SERVER['DOCUMENT_ROOT'].'/_includes/cesei_globals.inc.php');
      validate_cesei_access(STATUS_ADMIN);

require_once($_SERVER['DOCUMENT_ROOT'].'/_lib/peer_review_tools.inc.php');
$savant->assign('section_title', 'CESEI Administration');
$savant->assign('section_href', '/admin/');
$savant->assign('page_title', 'Review Committee');

$savant->assign('path', Array(Array('url'=>'index.php','title'=>'Education Administration')) );

$sub_level_pages = Array();
$sub_level_pages[0]  = Array('url'=>'select_committee_members.php','title'=>'Manage Committee Review');
$sub_level_pages[1]  = Array('url'=>'','title'=>'Add Committee Members');
$back_to_page = Array('url'=>$_PORTALS[PORTAL_ID]['root'].'/admin/edu/','title'=>'Educational Administration');

$savant->assign('sub_level_pages', $sub_level_pages);
$savant->assign('back_to_page', $back_to_page);
$savant->assign('extra_hdr_tags', '<link rel="stylesheet" type="text/css" media="screen" href="/_css/peer_review.css" />');
if(!isset($_POST['module_id'])){
  $msg->addFeedback('You need to select a module');
  header('Location: select_committee_members.php');
  exit;
} else{
  $module_id = $_POST['module_id'];
}
if(isset($_POST['Submit'])){
$sql_3 ="UPDATE cesei_review_done SET voting_method=".$_POST['voting_method']." WHERE module_id=".$_POST['module_id'] ;
$result_3 = mysql_query($sql_3, $db);
  $msg->addFeedback('Voting method is edited.');
  header('Location: select_committee_members.php');
  exit;
}

$sql_2 ="SELECT voting_method FROM cesei_review_done WHERE module_id=".$module_id ;
$result_2 = mysql_query($sql_2, $db);
$voting_method =mysql_result($result_2, 0);
if($voting_method==1) $voting_method_s="Online";
else $voting_method_s="Offline";

$sql0 = "SELECT  title FROM edu_courses WHERE course_id=".$module_id;
$result0 = mysql_query($sql0,$db);
$module_title =mysql_result($result0, 0);
$savant->display('document_top.tmpl.php'); 
echo '<p>'.$module_title.'</p>';
?>
Select a voting method: <br />
   <form name="form" method="post" action="<?php echo($_SERVER['PHP_SELF']); ?>">
   <div class="input-form">
<Input type = 'Radio' Name ='voting_method' value= 0
<?PHP if($voting_method!=1) echo 'checked'; ?> > Offline
<br />
<Input type = 'Radio' Name ='voting_method' value= 1
<?PHP  if($voting_method==1) echo 'checked'; ?> >Online

<P>
 <input type="hidden" name="module_id" value=<?php echo $_POST['module_id']; ?> />
<Input type = "Submit" Name = "Submit" VALUE = "Submit">
   </div>
</form>
<?php $savant->display('document_bottom.tmpl.php'); ?>

Wednesday, October 16, 2013

Rewrite peer review process (2)




C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\admin\edu\pr_members.php
line 24 add:
$sub_level_pages[2]  = Array('url'=>'pr_manage_new.php','title'=>'Manage Review Process (new)'); 
$sub_level_pages[3]  = Array('url'=>'select_committee_members.php','title'=>'Manage Committee Review');
cp C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\admin\edu\pr_members.php
to select_committee_members.php, modify select_committee_members.php as follows:
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
define('PORTAL_ID', 0); ?>
<?php require_once($_SERVER['DOCUMENT_ROOT'].'/_includes/cesei_globals.inc.php');
validate_cesei_access(STATUS_ADMIN);

require_once($_SERVER['DOCUMENT_ROOT'].'/_lib/peer_review_tools.inc.php');
$savant->assign('section_title', 'CESEI Administration');
$savant->assign('section_href', '/admin/');
$savant->assign('page_title', 'Review Committee');

$savant->assign('path', Array(Array('url'=>'index.php','title'=>'Education Administration')) );

$sub_level_pages = Array();
$sub_level_pages[0]  = Array('url'=>'pr_manage.php','title'=>'Manage Review Process');
$sub_level_pages[1]  = Array('url'=>'pr_members.php','title'=>'Review Committee');
$sub_level_pages[2]  = Array('url'=>'pr_manage_new.php','title'=>'Manage Review Process (new)');
$sub_level_pages[3]  = Array('url'=>'','title'=>'Manage Committee Review');
$back_to_page = Array('url'=>$_PORTALS[PORTAL_ID]['root'].'/admin/edu/','title'=>'Educational Administration');

$savant->assign('sub_level_pages', $sub_level_pages);
$savant->assign('back_to_page', $back_to_page);
$savant->assign('extra_hdr_tags', '<link rel="stylesheet" type="text/css" media="screen" href="/_css/peer_review.css" />');

$savant->display('document_top.tmpl.php'); 

?>
<script>
function submit_edit_member(){
   document.forms['module_form'].action = 'pr_members_modules.php';
   document.forms['module_form'].submit();
}

function submit_edit_voting(){
   document.forms['module_form'].action = 'pr_voting.php';
   document.forms['module_form'].submit();
}
</script>
<p> Use this tool to add or edit committee members for modules under review. </p>
<form name="module_form" method="post" action="pr_members_modules.php">
   <div class="input-form">
   <table summary="" class="data" rules="cols"><thead>
      <tr>
         <th>&nbsp;</th>
         <th>Module title</th>
         <th>Committee Members</th>
          <th>Voting Method</th>
      </tr>
   </thead>
   <tbody>
   <?php
   $page_content = '';
   $sql = "SELECT  module_id FROM  cesei_review_done WHERE review_done=1";
   $result = mysql_query($sql,$db);
   while($row = mysql_fetch_assoc($result)) {
        $module_id = $row['module_id'];
        $sql0 = "SELECT  title FROM edu_courses WHERE course_id=".$module_id;
        $result0 = mysql_query($sql0,$db);
          $module_title =mysql_result($result0, 0);
        $sql_1 = "SELECT
                  M.prefix,M.first_name,M.last_name
                  FROM cesei_module_user_reviews MUR
                  LEFT JOIN cesei_members M ON MUR.member_id=M.member_id WHERE MUR.module_id=".$module_id ;
        $result_1 = mysql_query($sql_1, $db);
         $reviewers = ' ';
        while($row_1 = mysql_fetch_assoc($result_1)){
             $reviewers .= trim(htmlspecialchars($row_1['prefix'].' '.$row_1['first_name'].' '.$row_1['last_name'])).',  ';
            
       }
       $reviewers = rtrim($reviewers, ", ");
       $sql_2 ="SELECT voting_method FROM cesei_review_done WHERE module_id=".$module_id ;
        $result_2 = mysql_query($sql_2, $db);
        $voting_method =mysql_result($result_2, 0);
        if($voting_method==1) $voting_method_s="Online";
        else $voting_method_s="Offline";
       $page_content .= '<tr onmousedown="document.module_form[\'mod'.$module_id.'\'].checked = true; rowselect(this);" id="r_'.$user['member_id'].'">
                         <td><input type="radio" name="module_id" value="'.$module_id.'" id="mod'.$module_id.'" /></td>
                         <td>'.$module_title.'</td>
                         <td>'.$reviewers.'</td>
                         <td>'.$voting_method_s.'</td>
                          </tr>';
             
   }
   echo($page_content);
   $page_content = ' ';
   ?>
   </tbody>
   </table>
   <br />
   <input type="submit" class="input-button" value="Add/edit committee members" name="add_edit" onclick="submit_edit_member()"/>
    <input type="submit" class="input-button" value="Edit Voting Method" name="edit_voting" onclick="submit_edit_voting()"/>
   <br />
</form>
  
<?php $savant->display('document_bottom.tmpl.php'); ?>

Change email notification when submitting a module for review




When submitting a module for review, only system administrator is notified   via email, not whole education committee.
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_lib\peer_review_tools.inc.php
line 192,  change
  while ($row_to = mysql_fetch_assoc($result_to)) {
      if($row_to['email'] != MAIL_DEFAULT){
         $mail->AddAddress($row_to['email']);
      }
   }
 
   $mail->AddBCC(MAIL_CESEI_ADMIN, MAIL_CESEI_ADMIN_NAME);

to

  $mail->AddAddress(MAIL_CESEI_ADMIN);

Tuesday, October 15, 2013

Rewrite peer review process (1)




Under admin/edu/pr_manage_new.php, add a button "Primary peer review  is done." If it is done,
then disable the button.
 admin/edu/pr_manage_new.php,
line 22 add
$sub_level_pages[3]  = Array('url'=>'select_committee_members.php','title'=>'Manage Committee Review');
 line 59 add
function submitReviewDone(){
   document.forms['revisons'].action = 'submit_reviewDone.php';
   document.forms['revisons'].submit();

 function submitChair(){
   document.forms['revisons'].action = 'submit_emailChair.php';
   document.forms['revisons'].submit();
}
line 118 add:

  $sql = "SELECT  review_done, email_chair FROM  cesei_review_done WHERE module_id=$module_id";
   $result = mysql_query($sql,$db);
   $review_result  = mysql_result($result, 0, 0);
   $email_chair  = mysql_result($result, 0, 1);

   if($review_result ==1) echo "Primary peer review is done. <br /><br />";

line 153 add:
   <input type="submit" class="input-button" name="reviewDone" value="Review is done" <?php if($review_result ==1) echo 'disabled="disabled"'; ?> onclick="submitReviewDone()"/>
<input type="submit" class="input-button" name="emailChair" value="Email notification to committee chair" <?php if(($review_result ==0)||($email_chair==1))
                        echo 'disabled="disabled"'; ?> onclick="submitChair()"/>

In MySQL,create a new table cesei_review_done
CREATE TABLE  `cesei_new1`.`cesei_review_done` (
   `module_id` mediumint(8) unsigned NOT NULL default '0',
   `creation_date` datetime NOT NULL default '0000-00-00 00:00:00',
   `review_done` mediumint(8) unsigned NOT NULL default '0',
   `email_chair` mediumint(8) unsigned NOT NULL default '0',
   `voting_method` mediumint(8) unsigned NOT NULL default '0',
   PRIMARY KEY  (`module_id`)
) ENGINE=MyISAM

Create new file: submit_reviewDone.php, copy from delete_review.php and modify:
line 37 change
   $sql    = "DELETE FROM cesei_review_new WHERE id=$rid";
to
    $creation_date = date('Y-m-d H:i:s');
     $sql    = "REPLACE INTO cesei_review_done VALUES ('$module_id','$creation_date', 1, 0, 0)";


line  40 comment out
$msg->addFeedback('RESULT_DELETED');
line 49 changed to
$title = '';
    $sql = "SELECT C.title,C.status FROM edu_courses C WHERE C.course_id = $module_id";
    $result = mysql_query($sql,$db);
   if($row = mysql_fetch_assoc($result)){
      if($row['status'] == 'approved'){
         $msg->addError('This module is already  approved.<br />Only modules that are not in approved stage can be submited for final approval.');
         header('Location: pr_manage_new.php?module_id='.$module_id);
        exit;
      }else{
         $title = $row['title'];
      }
   }else{
      $msg->addError('Module not found');
      header('Location: pr_manage_new.php?module_id='.$module_id);
     exit;
   }
   $sql = "UPDATE edu_courses SET hide=0,status='review' WHERE course_id = $module_id";
   @mysql_query($sql,$db);
   //check to see if this is a first timer
   $sql = "SELECT revision_cycle FROM cesei_module_reviews WHERE module_id=$module_id ORDER BY revision_cycle DESC";
   $result = mysql_query($sql,$db);
   $num_rows = mysql_num_rows($result);
   $revision_cycle = 1;
 
   //add it to module_reviews
  if($num_rows<1)
   $sql = "INSERT INTO cesei_module_reviews VALUES($module_id,$revision_cycle,'in_review','pending','',NOW(),'0000-00-00','0000-00-00','0000-00-00')";
   else
     $sql = "UPDATE cesei_module_reviews SET state='in_review',date_in_review=NOW() WHERE module_id=$module_id AND state='submitted'";
    $creation_date = date('Y-m-d H:i:s');
    $sql    = "REPLACE INTO cesei_review_done VALUES ('$module_id','$creation_date', 1, 0)";
    $result    = mysql_query($sql, $db);
    header('Location: pr_manage_new.php?module_id='.$module_id);
    exit;


Create new file: submit_emailChair.php:
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
define('PORTAL_ID', 0);
require_once($_SERVER['DOCUMENT_ROOT'].'/_includes/cesei_globals.inc.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/_lib/peer_review_tools.inc.php');
validate_cesei_access(STATUS_ADMIN);


$savant->assign('section_title', 'CESEI Administration');
$savant->assign('section_href', '/admin/');
$savant->assign('page_title', 'Email Notification to Chiar');

$savant->assign('path', Array(Array('url'=>'index.php','title'=>'Education Administration')) );

$sub_level_pages = Array();
$sub_level_pages[0]  = Array('url'=>'pr_manage_new.php','title'=>'Manage Peer Review (new)');
$sub_level_pages[1]  = Array('url'=>'','title'=>'Delete Review');
$back_to_page = Array('url'=>$_PORTALS[PORTAL_ID]['root'].'/admin/edu/','title'=>'Educational Administration');

$savant->assign('sub_level_pages', $sub_level_pages);
$savant->assign('back_to_page', $back_to_page);        
$module_id = intval($_POST['module_id']);
$module_title =  $_POST['module_title'];

$rid = intval($_POST['rid']);

if (isset($_POST['submit_no'])) {
    $msg->addFeedback('CANCELLED');
    header('Location: pr_manage_new.php?module_id='.$module_id.'&rid='.$rid);
    exit;

} else if (isset($_POST['submit_yes'])) {
   include($_SERVER['DOCUMENT_ROOT'].'/_includes/email_content.inc.php');
   $committee_members = get_pr_members();
    foreach($committee_members as $member){
       if($member['is_chair'] == 1) $email = $member['email'];
    }
     $sql_1 = "UPDATE cesei_review_new set prefix='$prefix', first_name='$first_name', last_name='$last_name', email='$email',
        review_date='$review_date',creation_date='$creation_date',module_id='$module_id',author='$author',comment='$comment'
        WHERE id=".$_POST['rid'];
   $sql    = "UPDATE cesei_review_done set email_chair=1 WHERE module_id=".$module_id;
   $result    = mysql_query($sql, $db);
   $mail = new PHPMailer();
   $mail->AddAddress($email);
  
   $mail->Subject = "Module ".$module_title." has requested for education committee approval";
   $_mail_body ="Dear Education Committee Chair,

    A new module, %1s, has been submitted to the ".INSTITUTION_SHORT_NAME." Education Committee for final approval.

     Please log-in to ".INSTITUTION_SHORT_NAME."'s peer review area to assign committee members to review this module.

    http://".$_SERVER_NAME."/education/peer_review/
    ";
  
   $mail->Body    = vsprintf($_mail_body.$_mail_cesei_ftr.$_mail_inquiry_ftr,$module_title);
       
       if(!$mail->Send()) {
              $msg->addError('There was an error sending the email message. Please try again in a few minutes.');
       }
    else{
            $msg->addFeedback('Email to committee chair for module final approval is sent.');
    }
    unset($mail);
    header('Location: pr_manage_new.php?module_id='.$module_id);
    exit;
}
$savant->display('document_top.tmpl.php');
unset($hidden_vars);
$hidden_vars['rid'] = $rid;
$hidden_vars['module_id'] = $module_id;
$hidden_vars['module_title'] = $module_title;
//$msg->addConfirm('DELETE_TEST_RESULTS_ALL', $hidden_vars);

$msg->addConfirm('Are you sure to send an email notification to committee chair for  module final approval?', $hidden_vars);
$msg->printConfirm();


 $savant->display('document_bottom.tmpl.php'); 
 ?>







Friday, October 11, 2013

CSS float and clear property




Sometimes, we use CSS float property to push an element left or right so the next element can be wrapped around,. CSS code:
float:right;
 What happen, if next  element does not want to be wrapped, we can use CSS property clear to not allow  floating elements  on the left or the right side, CSS code:
clear:both;

Example 1: in WikiWP blogger template,  the message body is too far from content, this is due to
clear:both; are use, remove clear:both; in CSS to fix the problem

Example 2: footer is in  same row as content, we need to add clear:both; before footer CSS to put the
footer down as a new line.

Use WinHTTrack to copy website and browse offline



WinHTTrack is an open source software in Windows for copying websites and browse them offline.
 There are also Linux version WebHTTrack, and Android version HTTrack.
It allows you to download a World Wide Web site from the Internet to a local directory, building recursively all directories, getting HTML, images, and other files from the server to your computer.

WinHTTrack can be downloaded from:
http://www.httrack.com/

To use WinHTTrack:
1) Open WinHTTrack application
2)  Click Next, create a new project name or using existing project name
3) Enter base path
4) Click next, you can choose "update existing download"  or "Download websites" or more
5) Click next and click finish,  WinHTTrack will start to copy

Example: copy my Google site to my local computer:
A) 2013 Reading note, 
1) Create project name  2013_reading_note
2) base path  C:\Users\jiansen\Desktop\CAS\jiansen_dir\google-site
 All my website copies can be found
file:///C:/Users/jiansen/Desktop/CAS/jiansen_dir/google-site/index.html
3) A directory  2013_reading_note will be created under base path

B) 2013 Web Server Note

1) Create project name  2013_webserver_note
2) base path  C:\Users\jiansen\Desktop\CAS\jiansen_dir\google-site

c) My computing blog:
1) Create project name jiansenlu_computing_blog
2) base path  C:\Users\jiansen\Desktop\CAS\jiansen_dir\google-site

Thursday, October 10, 2013

Using wiki style in blogger



Download wiki style template from blogger from:
http://aryakamandhanuputraseplawan.blogspot.ca/2012/02/simple-wiki-wikipedia-style-blogger.html
unzip and you can find wikiWP.xml

Create new blog in blogger use simple view:
http://jiansenlucodelogger.blogspot.com/

Go to template: backup/restore, upload: wikiWP.xml
This template can not add Adsense automatically at sidebar, but OK at bottom.  I added it via  blogger settings
->Post and comments ->Post template, put Adsense JS code inside.

Another wiki blogger demo site:
http://wptb-wikiwp.blogspot.ca/


Do the following modification:
All links in home page are  stuck, but for each page OK.
line 287 remove
.excerpt
{
  margin-bottom:32px;
  float:left;
  width:100%;
}


Upload image directory to your server, replace all http://www.opendrive.com/files/
to your servers.

change logo.png to your logo and modify line 51 accordingly
#logo { position:absolute; top:0; left:0; cursor:pointer; width:155px; height:155px; margin:0; padding:0; z-index:1; }

Due to archive list in sidebar background image overlap with the first letter
remove line 129 and 134
 background:url('http://www.opendrive.com/files/6964790_2IFXV/bullet.jpg') no-repeat 0 4px;

The message box is too far from the post title, line 1549 remove   <div style='clear: both;'/> under
       <b:includable id='status-message'>
  <b:if cond='data:navMessage'>
  <div class='status-msg-wrap'>
    <div class='status-msg-body'>
      <data:navMessage/>
    </div>
    <div class='status-msg-border'>
      <div class='status-msg-bg'>
        <div class='status-msg-hidden'><data:navMessage/></div>
      </div>
    </div>
  </div>

Design department database



C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\ubc_surgery_pub\demosite\index.php
line 4 add:
session_start();
Add a login and logout session: line 11 add:
$url="../scripts/personal/";
if(!isset($_SESSION['username']))

    {
      if(isset($_POST['submit_login']))
         {
         if( isset($_POST['name']) && isset($_POST['pass']) && ($_POST['name']==$admin_name) && ($_POST['pass']==$admin_password) )
             {
             $_SESSION['username'] = $admin_name;
             }else{
             echo "<div class='login-msg'>Incorrect Login </div>";
            }
        }
    }

// end login session with logout

if(isset($_GET['action']) && ($_GET['action']=='logout'))
    {
    session_destroy();
    unset($_SESSION['username']);
    $url = str_replace('?action=logout', '', $_SERVER['PHP_SELF']);
    echo $url;
    header("Location: $url");
    exit();
    }
   
    $html=true;


Local test site:
http://localhost/ubc_surgery_pub/demosite/

remote site:
http://139.173.32.21/ubc_surgery_pub/demosite/

remote directory:
web_root/cesei/ubc_surgery_pub/demosite