Adsense
Popular Posts
- Amazon web serive
- MySQL workbench -"Could not decrypt password cache"
- git svn conversion
- increase mysql query speed
- Unix Utils and wget in Windows
- add comment to table columns in phpMyAdmin
- Special characters pronunciation link
- deposit cheque in TD bank using Mobile phone
- Setup vi syntax for PHP
- Get WAMP running on EC2
Tuesday, December 31, 2013
Six major PHP frameworks
Six major PHP frameworks:
1) Akelos
http://akelos.org
2) Cake
http://cakephp.org
3) CodeIgniter
http://codeigniter..com
4) Kohana
http://kahanaphp.com
5) Symfony
http://symfony-project.org
6) Zend Framework
http:// framework.zend.com
Sunday, December 29, 2013
PHP, file and directory operation
fopen, fwrite, fread, fcolse, file_put_contents, file_get_contents,
change file line break to HTML line break: nl2br
example:
if($handle=fopen(test.txt','r')){
$content=fread($handle);
fclose($handle);
}
echo nl2br($content);
Get line by line fgets
if($handle=fopen(test.txt','r')){
while(1feof($handle)(
$content=fgets($handle);
echo $content."<br />";
}
fclose($handle);
}
filesize: file size
filemtime: modified time (change content)
filectime: changed time (change content or metadata such as chmod)
fileatime: last access time such as read or change.
Example
echo strftime('%m/%d/%Y %H%M', filemtime($filename))."<br />";
touch($filename): update file time.
Directory operation
get current working directory: getcwd
create a new directory: mkdir
Example
makdir('mydir','0777'); //note permission may be overwritten by umask
makdir('mydir/dir1/dir2','0777',true);recursively create new directoy
change directory chdir
remove a directory: rmdir
is_dir: to check if it is a directory
opendir: open directory to get directory handler
readdir: to get each file in a directory
Example:
if($mydir=opendir('test')){
while($filename=readdir($mydir))
echo $filename.'<br />';
}
Close directory: closedir
scandir: read all file names in the directory into an array
Example:
$file_array=scandir('test');
foreach($file_array as $filename)
echo $filename.'<br />';
To remove . and .. in the array, we can add
if(stripos($filename, '.')>0) // i.e first occurrence of '.' not the first position.
>> »
Friday, December 20, 2013
CSS, @import and @keyframes
To include CSS file "mystyle.css" in a CSS file, using
@import "mystyle.css";
or
@import url("mystyle.css");
To create an animation in CSS, using @keyframes, example:
@keyframes mymove
{
from {top:0px;}
to {top:10px;}
}
/* Safari and Chrome */
@-webkit-keyframes mymove
{
from {top:0px;}
to {top:10px;}
}
load to external web -font
@font-face
Reference:
http://www.w3.org/TR/CSS/
CSS framework:
http://blueprintcss.org/
HTML5 and DOM animation
HTML5 animation used Canvas. Call raf,js
using requestAnimationFrame, For example
function loop() {
requestAnimationFrame(loop);
}
DOM animation:
To change a position of an object
<div id="box"></div>
Js script
d= doucment.getElementById("box);
d.style.left = x + "px";
d.style.top = y + "py";
JavaScript 3d library
http://threejs.org/
CreateJS: A suite of Javascript libraries & tools for building rich, interactive experiences with HTML5.
http://www.createjs.com
Wednesday, December 18, 2013
Microsoft Internet Explorer testdrive and Several good course from lynda.com
Microsoft Internet Explorer testdrive
http://ie.microsoft.com/testdrive/
Several good course from lynda.com
1. Mobile Web Design & Development Fundamentals with Joe Marini
2. Web design fundamentals
3. HTML5
4. CSS Fundamentals with James Williamson
5. HTML5 for Flash Developers with Lee Brimelow
6. PHP
7. MySQL
8. Apache
Monday, December 16, 2013
Measurement webpage performance
To measure webpage performance, we can use window.performance.timing object.
To calculate loading time, we can use loadEventEnd - navigationStart under use window.performance.timing.
Example code
<script type='text/javascript'>
function loadingtime() {
if (!!window.performance) {
// navigation time is loadEventEnd - navigationStart
var timingData = window.performance.timing;
document.querySelector("#loadtime").innerHTML = (timingData.loadEventEnd - timingData.navigationStart);
}
else {
document.querySelector("#message").innerHTML = "<p>This browser does not support the <code>performance</code> object</p>";
}
}
function init() {
setTimeout(loadingtime, 500);
}
window.onload = init;
</script>
<div id="message">
<p><span class="label">Load Time: </span><span id="loadtime"></span>ms</p>
</div>
Friday, December 13, 2013
Backup before Christmas shutdown
1) Backup file repository and database of main and research projects to local and mirror site.
2) Recursively (incremental) backup local computer directories CAS and real-server to external drive (j)
I used Deltacopy\rsync.exe (download from Internet) to backup files in Windows 7 to external disk J.
type cmd in Windows search box in Start, under Windows prompt
C:\Deltacopy\rsync.exe -v -rlt -z -p --chmod=ugo=rwX --delete /cygdrive/c/Users/jiansen/desktop/CAS/ /cygdrive/j/jiansen-office/CAS/
C:\Deltacopy\rsync.exe -v -rlt -z -p --chmod=ugo=rwX --delete /cygdrive/c/Users/jiansen/desktop/real-server/ /cygdrive/j/jiansen-office/real-server/
C:\Deltacopy\rsync.exe -v -rlt -z -p --chmod=ugo=rwX --delete "/cygdrive/c/Users/jiansen/Google Drive/" /cygdrive/j/jiansen-office/GoogleDrive/
Access to online remote desktop application fail
Install Citrix receiver for Windows.
Tuesday, December 10, 2013
Reviewer Subject Assignments bug in research portal
Reviewer Subject Assignments work fine in original website, but failed in mirror site.
Reviewer assignment not saved in project NASA QCPR 2.
http://dev.cesei.org:8080/research/projects/manage_review_assignments.php
modify C:\php\php.ini in dev.cesei.org
line 384 change
max_execution_time = 30
to
max_execution_time = 300
line 405 change
memory_limit = 128M
to
memory_limit = 256M
line 801 change
upload_max_filesize = 2M
to
upload_max_filesize = 100M
line 805 add
upload_tmp_dir ="C:\LMS\file_uploads"
apache, cannot delete error.log
C:\Program Files\Apache Software Foundation\Apache2.4\logs
around 30G
stop Apache server first, dete error.log, then restart server
Still not fix the problem, check
C:\Program Files\Apache Software Foundation\Apache2.4\logs\error.log
error message:
Tue Dec 10 13:39:20.820054 2013] [:error] [pid 248:tid 1116] [client 142.103.72.45:59138] PHP Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0, referer: http://dev.cesei.org:8080/research/projects/manage_review_assignments.php
php.ini, line 401 change
; max_input_vars = 1000
to
max_input_vars = 100000
Friday, December 6, 2013
Merge items for review and survey tabs in MY Survey in research projects
Items for review and survey side by side, not in different tabs, and move the question by scrolling. File
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\research\projects\review_survey.php
Modify
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_templates\rp_review_survey.tmpl.php
line 29 change
<div class="row">Please refer to the tabs below and to the right to view the <?php echo($asset_string); ?> and applicable survey.</div>
to
<div class="row">Please refer to below to view the <?php echo($asset_string); ?> and applicable survey.</div>
Remove line 38-39
<div id="project-survey" onclick="set_mod_filter('survey');">Survey</div>
<div id="project-asset" onclick="set_mod_filter('asset');"><?php echo( ucwords($asset_string)); ?></div>
line 41 change
<div id="project-group-asset" style="display:none;">
to
<div id="project-group-asset" style="display:block; width:48%; overflow:auto;float: left;" >
<h2><?php echo( ucwords($asset_string)); ?></h2>
line 67 change
<div id="project-group-survey" style="display:none;">
to
<div id="project-group-survey" style="display:block; width:48%; height: 800px; overflow:auto; float: right;" >
<h2>Survey</h2> <br />
In Canhealth, still keep 60% and 35%.
Under my survey, remove, video link
http://dev.cesei.org:8080/research/projects/view_project.php?pid=48
rp_view_project.tmpl.php
rp_reviewer_details.tmpl.php
line 115 change
echo('<a href="'.$asset_props['link'].'" class="review-item">'.$asset_props['file_name'].'</a>');
to
echo($asset_props['file_name']);
Wednesday, December 4, 2013
Meta tags for mobile site and more concepts and references for mobile application
These three meta tags tell the mobile browser to display the webpage as in mobile screen size, not desktop.
<meta name="HandheldFriendly" content="true" />
<meta name="MobileOptimized" content="320" />
<meta name="Viewport" content="width=device-width" />
For Windows Phone, iPhone, Android, Opera, they have different default width values. Windows Phone 7: 1024 pixels, iPhone: 980, Android and Mobile Opera: 800 px (note 100px=2.646cm)
for "Zoom out" size instead of its real size. Using "width=device-width" to force display in actual device width. For example:iphone resolution: 640 x 960 px, actual device-width and height: 320 x 480.
reference:
http://www.javascriptkit.com/dhtmltutors/cssmediaqueries2.shtml
http://www.javascriptkit.com/dhtmltutors/cssmediaqueries3.shtml
User agent switcher 0.7.3 add-on for Firefox. I only see iphone 3.0. We can add android and iphone 5 by click edit button. User agent strings can be found
http://www.useragentstring.com/pages/useragentstring.php
webkit used by Apple's Safari web browser and Google's Chrome web browser versions up to 27,
Trident engine used by Internet Explorer, and the Gecko engine used by Firefox.
CSS media queries:
In CSS:
@media screen and (max-width:800px) {
}
@media screen and (min-width: 801px) {
}
modernizr is a JavaScript library to detect CSS3 and HTML5 features in user browser.
http://modernizr.com/
To use modernizr JavaScript librar:
<script src="modernizr-1.7.js" type="text/javascript"></script>
test for geolocation feauter
Modernizr.geolocation will return true or false.
test for touch feauture
Modernizr.touch
Test for HTML5 feature
Modernizr.svg
Modernizr.canvas
Tuesday, December 3, 2013
Click link to call in mobile browser
To callin mobile phone via clicking a link, the following syntac is used:
<a href="tel:+1800666666">Call us free!</a>
More about this:
http://www.mobilexweb.com/blog/click-to-call-links-mobile-browsers
Monday, December 2, 2013
mobione swipe and alternatives
Mobione iphone image swipe slider tutorial
https://www.youtube.com/watch?v=dsb4TDWjwlc
mobione alternatives:
http://alternativeto.net/software/mobione/
try Appcelerator Titanium
Open Source by Appcelerator Inc. |
Mac, Windows, Linux, Online
http://www.appcelerator.com/
Install appcelerator Titanium Studio in Windows 7
C:\Users\jiansen\AppData\Local\Titanium Studio\
Run Titanium Studio
error message
"failed to create java virtual machine"
Solution:
remove
--launcher.XXMaxPermSize
256m
from
C:\Users\jiansen\AppData\Local\Titanium Studio\TitaniumStudio.ini line 5
Some other software:
skitch
http://evernote.com/skitch/
swipe
http://stackoverflow.com/questions/5200497/sliding-and-swiping-through-pages-with-javascript-on-ipad
phonegap
https://build.phonegap.com/apps
https://developer.apple.com/
Friday, November 29, 2013
Reviewer bug in research portal
When admin assign himself as reviewer, view_project.php hanged.
This is due to that
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\research\projects\view_project.php
line49
$reviewer = get_reviewer($_SESSION['member_id']);
call get_reviewers function in
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\research\_lib\projects\reviewer_tools.inc.php
get_reviewers function is very complicated to make system hanged.
Solution:
1. Reduce research database.
2. CESEI PHP error log need to be cleaned often
C:\php5.3.1\error.log, around 9GB. Difficult to open and write.
3. Think about new algorithm to write function
get_reviewers
Use $start=microtime(true); $end=microtime(true);
$end-start to get processing time in seconds in get_reviewers function.
or try
echo date('h:i:s') . "\n";
to see time difference.
Find
$sql = "SELECT subject_id,study_code,active,reminders FROM subjects WHERE subject_id IN(
SELECT subject_id FROM review_slot_subjects WHERE review_slot_id
IN (SELECT review_slot_id FROM review_slots WHERE project_id=$pid AND review_slot_id
IN (SELECT review_slot_id FROM review_slot_reviewers WHERE member_id=$rid))) ORDER BY study_code";
$result = mysql_query($sql, $db);
take about 2 minutes.
change the statement into two steps:
//step 1
$sql = "SELECT subject_id FROM review_slot_subjects WHERE review_slot_id
IN (SELECT review_slot_id FROM review_slots WHERE project_id=$pid AND review_slot_id
IN (SELECT review_slot_id FROM review_slot_reviewers WHERE member_id=$rid))";
$result = mysql_query($sql, $db);
$subject_id_array=array();
while($row = mysql_fetch_assoc($result)) $subject_id_array[]=$row['subject_id'];
//step 2
$matches = implode(',',$subject_id_array);
$sql = "SELECT subject_id,study_code,active,reminders FROM subjects WHERE subject_id IN(
$matches) ORDER BY study_code";
$result = mysql_query($sql, $db);
The MySQl execution time is reduced to few seconds.
Thursday, November 28, 2013
Research Portal Improvements
1) Side by side video and questionnaire. Reviewers through North America definitely want the ability to watch videos and do questionnaires side by side. Some groups have already started using SurveyMonkey or GoogleDocs to host the surveys so they can watch the videos and do the surveys at the same time:
Answer: check code:
http://localhost/research/projects/review_survey.php?mid=1&rid=103&sid=74&iid=132
Project: 500 test
5) Cloning/copying projects.
2) Import Reviewers. Currently, reviewers for research project needs to be added one by one. If a user already has Research Portal membership, they still need to be added from the research membership into the research project. After working with customers for several years, they would really like the ability to import users via CSV directly into a project. Note: some reviewers might be reviewers in several projects.
Answer: This will add burden of the user member database. CSV file is needed in right format. Need to think more.
3) Import tests for subjects and reviewers. Currently each question needs to be type one by one or cut and past one by one. It would be a lot better for CESEI admin and for Research Portal customers if we can import tests via CSV in the same way as the education portal.
Answer: This was already done. Under test schedule, Add New Questions, upload questions tab.
4) Import Custom Study Codes. Currently, if there are 500 subjects, and if there are unique study code chosen by the Principal Investigator for each subject, then each study code needs to be manually assigned. Import through CSV would save a lot of time.
Answer: This was already done. Under upload data, click subject information.
5) Cloning/copying projects.
Answer: done, still verifying.
Customer Complaints
1. The most frequently heard customer complaint was the load times in a research project, regardless if videos were involved or not. We already tried reducing the bit rate and the total size of each video, and although this helps in reducing the time to stream and playback videos, it doesn’t affect the slow load times in other areas of the research portal.
Answer: OK
Wednesday, November 20, 2013
Some bugs when migrating to canhealth for copy research projects
copy manage_review_assignments.php under research/projects
cop research/_lib/projects/tools.inc.php. rp_manage_review_assignment.php
DELETE FROM cnsh_research_projects.review_slot_reviewers WHERE review_slot_id=0;
DELETE FROM cnsh_research_projects.review_slot_subjects WHERE review_slot_id=0;
DELETE FROM cnsh_research_projects.subject_assets WHERE asset_id=0 ;
DELETE FROM cnsh_research_projects.survey_questions WHERE survey_id=0;
DELETE FROM cnsh_research_projects.test_questions WHERE test_id=0;
Finally to solve extra subjects under last reviewers using:
DELETE FROM cnsh_research_projects.review_slot_reviewers;
DELETE FROM cnsh_research_projects.review_slot_reviewers;
DELETE FROM cnsh_research_projects.review_slot_subjects;
http://139.173.32.21:8081/research/projects/view_project.php?pid=12
custom group is not transfer properly.
This is due to that in table cnsh_research_projects.test_schedule_groups
if custom_group =1, group_id should use c_group_id in custom group.
admin/research_projects/copy_rp.php. line 479 change
if($key == 'group_id'){
$s3[] = "group_id=".$group_match[$row3['group_id']] ;
continue;
}
to
if($key == 'group_id'){
if($row3['custom_group']==1) $s3[] = "group_id=".$c_group_match[$row3['group_id']] ;
else
$s3[] = "group_id=".$group_match[$row3['group_id']] ;
continue;
}
http://139.173.32.21:8081/research/projects/upload_subject_data.php,
subject is not attached.
research/projects/upload_subject_asset.php copy from cesei
Tuesday, November 19, 2013
Insert into table values and insert into table set in MySQL
Insert into table values and insert into table set in MySQL are identical.
Example
INSERT INTO table_1 (a, b, c) VALUES (1,2,3)
is the same as
INSERT INTO table_1 SET a=1, b=2, c=3
Monday, November 18, 2013
Recursively backup local computer directories to external drive
Recursively (incremental) backup local computer directories CAS and real-server to external drive (j)
I used Deltacopy\rsync.exe (download from Internet) to backup files in Windows 7 to external disk J.
type cmd in Windows search box in Start, under Windows prompt
C:\Deltacopy\rsync.exe -v -rlt -z -p --chmod=ugo=rwX --delete /cygdrive/c/Users/jiansen/desktop/CAS/ /cygdrive/j/jiansen-office/CAS/
C:\Deltacopy\rsync.exe -v -rlt -z -p --chmod=ugo=rwX --delete /cygdrive/c/Users/jiansen/desktop/real-server/ /cygdrive/j/jiansen-office/real-server/
C:\Deltacopy\rsync.exe -v -rlt -z -p --chmod=ugo=rwX --delete /cygdrive/c/Users/jiansen/desktop/_swf/ /cygdrive/j/jiansen-office/_swf/
C:\Deltacopy\rsync.exe -v -rlt -z -p --chmod=ugo=rwX --delete "/cygdrive/c/Users/jiansen/Google Drive/" /cygdrive/j/jiansen-office/GoogleDrive/
C:\Deltacopy\rsync.exe -v -rlt -z -p --chmod=ugo=rwX --delete /cygdrive/c/Users/jiansen/desktop/saudi.txt /cygdrive/j/jiansen-office/saudi.txt
C:\Deltacopy\rsync.exe -v -rlt -z -p --chmod=ugo=rwX --delete /cygdrive/c/Users/jiansen/desktop/conftool/ /cygdrive/j/jiansen-office/conftool/
C:\Deltacopy\rsync.exe -v -rlt -z -p --chmod=ugo=rwX --delete /cygdrive/c/Users/jiansen/desktop/jiansen_transfer/ /cygdrive/j/jiansen-office/jiansen_transfer/
Thursday, November 14, 2013
PHP, copy directory
The following PHP function copys is used to copy entire directories
* Allows the copying of entire directories.
* @access public
* @param string $source the source directory
* @param string $dest the destination directory
* @return boolean whether the copy was successful or not
function copys($source,$dest)
{
if (!is_dir($source)) {
return false;
}
if (!is_dir($dest)) {
mkdir($dest);
}
$h=@dir($source);
while (@($entry=$h->read()) !== false) {
if (($entry == '.') || ($entry == '..')) {
continue;
}
if (is_dir("$source/$entry") && $dest!=="$source/$entry") {
copys("$source/$entry", "$dest/$entry");
} else {
@copy("$source/$entry", "$dest/$entry");
}
}
$h->close();
return true;
}
Wednesday, November 13, 2013
MYSQL: copy row value and modify
For example I have table projects, projects, project_id is primary key, auto increment:
CREATE TABLE `research_projects_new1`.`projects` (
`project_id` mediumint(8) unsigned NOT NULL auto_increment,
`name` varchar(255) NOT NULL default '',
`owner_id` mediumint(8) unsigned NOT NULL default '0',
`date_created` datetime NOT NULL default '0000-00-00 00:00:00',
`date_start` datetime NOT NULL default '0000-00-00 00:00:00',
`date_end` datetime NOT NULL default '0000-00-00 00:00:00',
`arms` tinyint(3) unsigned NOT NULL default '0',
`groups` tinyint(3) unsigned NOT NULL default '0',
`subjects` smallint(5) unsigned NOT NULL default '0',
`auto_study_code` tinyint(1) NOT NULL default '1',
`subject_demographics` text,
`subject_to_group` enum('ordered','random','manual') NOT NULL default 'ordered',
`reviewer_to_subject` enum('ordered','random','manual') NOT NULL default 'ordered',
`reviewer_assignment_rule` enum('subject','arm_group','arm','group') NOT NULL default 'arm_group',
`subjects_per_review_slot` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`project_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Below is PHP code to copy a row value and change the date_created and name column values:
Her we use inset into ...set..
$nl = "\r\n";
$insert_set = "INSERT INTO `%1s` SET %2s;".$nl;
$sql_insert = '';
$s1 = '';
$s2 = array();
$sql = "SELECT * FROM projects WHERE project_id=$project_id";
$result = mysql_query($sql,$db);
if($row = mysql_fetch_assoc($result)) {
$s1 = 'projects';
$s2 = array();
foreach($row as $key=>$value){
if($key == 'project_id'){
$s2[] = 'project_id=0';
continue;
}
if($key == 'date_created'){
$s2[] = "date_created = NOW()";
continue;
}
if($key == 'name'){
$s2[] = "name ='$project_name'";
continue;
}
$value = addslashes($value);
$s2[] = "$key='$value'";
}
$sql_insert = (vsprintf($insert_values,Array($s1,implode(',',$s2))));
mysql_query($sql_insert,$db);
$new_project_id = mysql_insert_id();
}
The MySQL statement is:
INSERT INTO `projects` SET project_id=0,name ='small project COPY',owner_id='37',date_created = NOW(),date_start='2008-07-21 00:00:00',date_end='2008-07-25 00:00:00',arms='1',groups='2',subjects='10',auto_study_code='1',subject_demographics='N;',subject_to_group='manual',reviewer_to_subject='ordered',reviewer_assignment_rule='subject',
subjects_per_review_slot='1';
We can also use insert into ...values
$nl = "\r\n";
$insert_values = "INSERT INTO `%1s` VALUES(%2s);".$nl;
$sql_insert = '';
$s1 = '';
$s2 = array();
//start with the base entry edu_courses
$sql = "SELECT * FROM projects WHERE project_id=$project_id";
$result = mysql_query($sql,$db);
if($row = mysql_fetch_assoc($result)) {
$s1 = 'projects';
$s2 = array();
foreach($row as $key=>$value){
if($key == 'project_id'){
$s2[] = '0';
continue;
}
if($key == 'date_created'){
$s2[] = "NOW()";
continue;
}
if($key == 'name'){
$s2[] = "'$project_name'";
continue;
}
$value = addslashes($value);
$s2[] = "'$value'";
}
$sql_insert = (vsprintf($insert_values,Array($s1,implode(',',$s2))));
mysql_query($sql_insert,$db);
$new_project_id = mysql_insert_id();
}
The MySQL statement is:
INSERT INTO `projects` VALUES(0,'small project COPY','37',NOW(),'2008-07-21 00:00:00','2008-07-25 00:00:00','1','2','10','1','N;','manual','ordered','subject','1');
Copy research projects and permission note
Borrow the ideas to copy modules
http://localhost/admin/edu/copy_module/
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_templates\cesei_nav.tmpl.php
line 84 add:
<li><a href="/admin/research_projects/copy_research_projects.php">Copy Research Projects</a></li>
create research_projects under admin
create files: copy_research_projects.php, copy_rp_files.php and copy_rp.php
Permission: (only accessed by admin, project owner and administrator. admin and owner can edit and delete the project. project administrator can only view project if project end date not expired)
http://localhost/research/projects/my_projects.php
Then Reviewer Subject Assignments, assign reviewers a subject code. Reviewers go to following address and enter study code and password
http://localhost/research/projects/take_test.php
cp*
return (hint)
Current system is modified and used generic code and same password, without distinguish between reviewers.
This is due to staff member manually input the test from reviewer paper result.
To do test, project end date should not be expired.
member_id in research database reviewers is connected to main database cesei_members
Only cesei member and research member can see the research tab.
Tuesday, November 12, 2013
PHP, dump all the defined classes and methods
PHP function get_declared_classes is used to return an array with the name of the defined classes
To dump all the defined classes,
<?php
print_r(get_declared_classes());
?>
or
<?php
foreach(get_declared_classes() as $class)
echo $class.'<br />';
?>
To dump all the defined methods form class Students,
<?php
print_r(get_class_methods());
?>
or
<?php
foreach(get_class_methods() as $method)
echo $method.'<br />';
?>
To dump all the defined variables form class Students,
?>
To dump all the defined variables form class Students,
<?php
print_r(get_class_vars());
?>
or also print out its value
<?php
foreach(get_class_vars() as $var=>$value)
echo "{$var}: {$value}.<br />";
Add search box for research projects
Add search box from the list:
http://www.cesei.org/research/projects/new_project.php
http://www.cesei.org/research/
rp_project_properties.tmpl.php
line 35 add
<div class="row">
<button type='button' id="filter3" onclick="searchstudent2('search3','owner_id')"> Search Project Owner </button>
<input type="text" id="search3" maxlength="80" onkeypress="handleKeyPress(event,this.form)" onkeyup="searchstudent2('search3','owner_id')" >
</div>
line 152 add:
<button type='button' id="filter2" onclick="searchstudent('search2','admins')"> Search Project Administrators</button>
<input type="text" id="search2" maxlength="80" onkeypress="handleKeyPress(event,this.form)" onkeyup="searchstudent('search2','admins-out')" >
using searchstudent2 in C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_js\utils.js
(note: possible a bug: checkValue(document.getElementById(selectout)); checkValue not found)
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_templates\rp_manage_reviewers.tmpl.php
line 36 add:
<button type='button' id="filter2" onclick="searchstudent('search2','reviewers-out')"> Search Project Administrators</button>
<input type="text" id="search2" maxlength="80" onkeypress="handleKeyPress(event,this.form)" onkeyup="searchstudent('search2','reviewers-out')" >
test
Friday, November 8, 2013
Bug in cesei mirror site
bug:
http://dev.cesei.org:8080/education/courses/tools/course_properties.php
blank page
add:
ini_set('display_errors', 1);
error_reporting(E_ALL);
result:
Strict Standards: Only variables should be assigned by reference in C:\LMS\cesei\education\courses\include\vitals.inc.php on line 152
change
$myLang =& $languageManager->getMyLanguage();
to
$myLang =$languageManager->getMyLanguage();
Fatal error: Cannot re-assign auto-global variable _FILES in C:\LMS\cesei\education\courses\include\classes\Backup\Backup.class.php on line 218
change
function upload($_FILES, $description) {
to
function upload($file, $description) {
New error
Strict Standards: Non-static method Language::getParentCode() should not be called statically in C:\LMS\cesei\education\courses\include\lib\output.inc.php on line 286
comment out error reporting
// ini_set('display_errors', 1);
//error_reporting(E_ALL);
Wednesday, November 6, 2013
Peer review (16) add email and oline mode cesei_review_new
Add archive_method in table cesei_review_new (for email, member_id=0)
ALTER TABLE `cesei_new1`.`cesei_review_new` ADD `archive_method` mediumint(8) unsigned NOT NULL default '0';
ALTER TABLE `cesei_new1`.`cesei_review_new` ADD `member_id` mediumint(8) unsigned NOT NULL default '0';
modify C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\admin\edu\add_review.php
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_lib\peer_review_tools.inc.php
add hide column for cesei_module_user_reviews_p
ALTER TABLE `cesei_new1`.`cesei_module_user_reviews_p` ADD `hide` mediumint(8) unsigned NOT NULL default '0';
or
DROP TABLE IF EXISTS `cesei_new1`.`cesei_module_user_reviews_p`;
CREATE TABLE `cesei_new1`.`cesei_module_user_reviews_p` (
`review_id` mediumint(8) unsigned NOT NULL auto_increment,
`member_id` mediumint(8) unsigned NOT NULL,
`module_id` mediumint(8) unsigned NOT NULL,
`revision_cycle` tinyint(3) unsigned NOT NULL default '0',
`is_complete` tinyint(3) unsigned NOT NULL default '0',
`date_assigned` date NOT NULL default '0000-00-00',
`date_complete` date NOT NULL default '0000-00-00',
`hide` mediumint(8) unsigned NOT NULL default '0',
PRIMARY KEY (`review_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `cesei_new1`.`cesei_module_user_review_data_p` (
`review_id` mediumint(8) unsigned NOT NULL,
`outline` text NOT NULL,
`content` text NOT NULL,
`evaluation` text NOT NULL,
`overall` text NOT NULL,
`rating_outline` tinyint(3) unsigned NOT NULL default '0',
`rating_content` tinyint(3) unsigned NOT NULL default '0',
`rating_evaluation` tinyint(3) unsigned NOT NULL default '0',
`rating_overall` tinyint(3) unsigned NOT NULL default '0',
`has_simulators` tinyint(3) unsigned NOT NULL default '0',
`simulators` text NOT NULL,
PRIMARY KEY (`review_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `cesei_new1`.`cesei_module_user_rebuttal_data_p` (
`review_id` mediumint(8) unsigned NOT NULL,
`re_outline` text NOT NULL,
`re_content` text NOT NULL,
`re_evaluation` text NOT NULL,
`re_overall` text NOT NULL,
`re_simulators` text NOT NULL,
PRIMARY KEY (`review_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Rename three table and create new new
DROP TABLE IF EXISTS `cesei_new1`.`cesei_module_user_reviews`;
CREATE TABLE `cesei_new1`.`cesei_module_user_reviews` (
`review_id` mediumint(8) unsigned NOT NULL auto_increment,
`member_id` mediumint(8) unsigned NOT NULL,
`module_id` mediumint(8) unsigned NOT NULL,
`revision_cycle` tinyint(3) unsigned NOT NULL default '0',
`is_complete` tinyint(3) unsigned NOT NULL default '0',
`date_assigned` date NOT NULL default '0000-00-00',
`date_complete` date NOT NULL default '0000-00-00',
PRIMARY KEY (`review_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `cesei_new1`.`cesei_module_user_review_data`;
CREATE TABLE `cesei_new1`.`cesei_module_user_review_data` (
`review_id` mediumint(8) unsigned NOT NULL,
`outline` text NOT NULL,
`content` text NOT NULL,
`evaluation` text NOT NULL,
`overall` text NOT NULL,
`rating_outline` tinyint(3) unsigned NOT NULL default '0',
`rating_content` tinyint(3) unsigned NOT NULL default '0',
`rating_evaluation` tinyint(3) unsigned NOT NULL default '0',
`rating_overall` tinyint(3) unsigned NOT NULL default '0',
`has_simulators` tinyint(3) unsigned NOT NULL default '0',
`simulators` text NOT NULL,
PRIMARY KEY (`review_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `cesei_new1`.`cesei_module_user_rebuttal_data`;
CREATE TABLE `cesei_new1`.`cesei_module_user_rebuttal_data` (
`review_id` mediumint(8) unsigned NOT NULL,
`re_outline` text NOT NULL,
`re_content` text NOT NULL,
`re_evaluation` text NOT NULL,
`re_overall` text NOT NULL,
`re_simulators` text NOT NULL,
PRIMARY KEY (`review_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
RENAME TABLE `cesei_new1`.`cesei_module_user_reviews`
TO `cesei_new1`.`cesei_module_user_reviews0`;
RENAME TABLE `cesei_new1`.`cesei_module_user_review_data`
TO `cesei_new1`.`cesei_module_user_review_data0`;
RENAME TABLE `cesei_new1`.`cesei_module_user_rebuttal_data`
TO `cesei_new1`.`cesei_module_user_rebuttal_data0`;
/education/instructor_resources/module_reviews.php
line 97 change
$rev_content .= '<div>› <a href="view_reviews.php?module='.
$module['course_id'].'&cycle='.($review_info['revision_cycle']).'">
Read and comment on reviews</a></div>';
to
$rev_content .= '<div>› <a href="reply_reviews.php?module='.
$module['course_id'].'&cycle='.($review_info['revision_cycle']).'">
Read and comment on reviews</a></div>';
copy reply_reviews.php from peer_review to /education/instructor_resources
Tuesday, November 5, 2013
Peer review (15) instructor read and reply to reviews
copy C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\education\peer_review\reviews.php to instructor_reviews.php and modify.
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\education\peer_review\index.php
line 47 add:
<ul><li>
<a href="instructor_reviews.php">My Modules In Review</a>
<br />Read my module reviews.</li>
<li>
<a href="module_reviews_reply.php">Read and comment on primary peer reviews</a>
<br />Read primary peer reviews and reply.</li>
</ul>
copy /education/instructor_resources/view_reviews.php to education\peer_review\reply_reviews.php
copy /education/instructor_resources/module_reviews.php education\peer_review\module_reviews_reply.php
copy old pr_read_reviews.tmpl.php to pr_read_reviews0.tmpl.php for reply_reviews.php
update
http://localhost/admin/edu/pr_manage_new.php
copy /_lib/peer_review_calls/add_reviewers.php to
admin/edu/add_primary_reviewers.php
create new table: cesei_module_user_reviews_p (add hide column later)
CREATE TABLE `cesei_new1`.`cesei_module_user_reviews_p` (
`review_id` mediumint(8) unsigned NOT NULL auto_increment,
`member_id` mediumint(8) unsigned NOT NULL,
`module_id` mediumint(8) unsigned NOT NULL,
`revision_cycle` tinyint(3) unsigned NOT NULL default '0',
`is_complete` tinyint(3) unsigned NOT NULL default '0',
`date_assigned` date NOT NULL default '0000-00-00',
`date_complete` date NOT NULL default '0000-00-00',
PRIMARY KEY (`review_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
create new table cesei_module_user_review_data_p
CREATE TABLE `cesei_new1`.`cesei_module_user_review_data_p` (
`review_id` mediumint(8) unsigned NOT NULL,
`outline` text NOT NULL,
`content` text NOT NULL,
`evaluation` text NOT NULL,
`overall` text NOT NULL,
`rating_outline` tinyint(3) unsigned NOT NULL default '0',
`rating_content` tinyint(3) unsigned NOT NULL default '0',
`rating_evaluation` tinyint(3) unsigned NOT NULL default '0',
`rating_overall` tinyint(3) unsigned NOT NULL default '0',
`has_simulators` tinyint(3) unsigned NOT NULL default '0',
`simulators` text NOT NULL,
PRIMARY KEY (`review_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
create new table cesei_module_user_rebuttal_data_p
CREATE TABLE `cesei_new1`.`cesei_module_user_rebuttal_data_p` (
`review_id` mediumint(8) unsigned NOT NULL,
`re_outline` text NOT NULL,
`re_content` text NOT NULL,
`re_evaluation` text NOT NULL,
`re_overall` text NOT NULL,
`re_simulators` text NOT NULL,
PRIMARY KEY (`review_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Monday, November 4, 2013
Peer review (14) Add online option besides email for primary reviewer
http://localhost/admin/edu/pr_manage_new.php
add new review from email, or setup online primary review
Previously instructor can only view and reply in "Review submission" in Instructor resources
Now move this in peer review
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_templates\cesei_nav.tmpl.php
line 212 change
if (isset($_SESSION['review_committee'])){
to
if(($_SESSION['portal_status']['edu'] == STATUS_INSTRUCTOR)||(isset($_SESSION['review_committee']))) {
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\education\peer_review\index.php
line 15 change
$access = validate_pr_access(false);
to
$access = validate_pr_access_new(false);
line 53 add
if($access == 'instructor') {
$page_content = '<p>Welcome to the CESEI module peer review area.<br />Below you will find the various peer review sections available to you.';
$page_content .= '<ol> <li><a href="reviews.php">My Modules In Review</a>
<br />Read my module reviews and reply.</li></ol>';
}
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_lib\peer_review_tools.inc.php
line 80 add
function validate_pr_access_new($guest_ok){
global $db;
if(!$_SESSION['member_id']){
header('Location: /no_access.php');
exit;
}
$sql = "SELECT is_chair FROM cesei_module_review_committee WHERE member_id=".$_SESSION['member_id'];
$result = mysql_query($sql, $db);
if($row = mysql_fetch_assoc($result)){
if($row['is_chair'] == 1){
return 'chair';
}else{
return 'member';
}
}
if(is_admin()){
return 'admin';
}
if(($_SESSION['portal_status']['edu'] == STATUS_INSTRUCTOR)) return 'instructor';
if(!$guest_ok){
if($_SESSION['review_committee'] == 'guest'){
header('Location: /education/peer_review/my_reviews.php');
exit;
}
}else{
if($_SESSION['review_committee'] == 'guest'){
return 'guest';
}
}
header('Location: /no_access.php');
exit;
}
peer review (13) Author can see the review
http://localhost/education/peer_review/index.php, line 37 put back:
<li><a href="reviews.php">Modules In Review</a>
<br />Listing and access to all current and past reviews</li>
(no, no change) ignore this page
http://localhost/education/peer_review/reviews.php
remove line 25
$sub_level_pages[3] = Array('url'=>'members.php','title'=>'Committee Members');
line 29 change (only review_is_done button clicked, the modules will be shown in review, waiting approval and complete)
$modules = get_all_reviewed_modules();
to
$modules_reviewed = get_all_reviewed_modules();
$modules['submitted'] = $modules_reviewed['submitted'];
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;
}
pr_all_modules.tmpl.php
remove line 133-176, 193-248 remove committee reviewer information
remove line 178 and 240
<div class="module-link">As the module's primary owner, reviewer information is unavailable.</div>
replace all read_reviews.php to read_reviews_author.php in
pr_all_modules.tmpl.php
Copy /education/peer_review/read_reviews.php to /education/peer_review/read_reviews_author.php
/education/peer_review/read_reviews_author.php, line 57 change
$savant->display('pr_read_reviews.tmpl.php');
to
$savant->display('pr_read_reviews_author.tmpl.php');
copy pr_read_reviews.tmpl.php to pr_read_reviews_author.tmpl.php
line 29 change
<br /><strong>Primary review results:</strong><br />
to
<br /><h3>Primary review results:</h3><br />
line 98 add:
<h3> Committee review results </h3>
line 129 change
<h2 class="flush-bottom">Overall Comments</h2>
to
<strong><br />Chair or admin comments in final approval:</strong>
line 138 remove
<h2 class="flush-bottom">Reviews</h2>
Friday, November 1, 2013
Peer review (12) modify my review for new process, add chiar view in admin
http://www.cesei.org/education/peer_review/my_reviews.php
C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\_lib\peer_review_tools.inc.php
line 650 change (under function get_my_reviewed_modules_new(){ )
WHERE MUR.member_id=$_SESSION[member_id] ORDER BY C.title, MR.revision_cycle";
to
LEFT JOIN cesei_review_done D ON MUR.module_id=D.module_id
WHERE MUR.member_id=$_SESSION[member_id] AND D.review_done=1 ORDER BY C.title, MR.revision_cycle";
http://localhost/admin/edu/pr_manage.php
Separate Manage Review Process into
Manage Review Process (old ) and
Manage Review Process (new)
copy /education/peer_review/chair_manage_modules.php to /admin/edu/pr_manage_chair.php
also modify top menu of:
http://localhost/admin/edu/pr_members.php
http://localhost/admin/edu/pr_manage_new.php
http://localhost/admin/edu/select_committee_members.php
/admin/edu/pr_members.php
add a search box
line 60 add:
<script>
function searchreviewers(search, selectout){
var searchvalue= document.getElementById(search).value;
var from_s = document.getElementById(selectout);
for (var i=0;i<from_s.options.length;i++) {
var st=from_s.options[i].text;
if(st.search(searchvalue)>-1) {
from_s.selectedIndex =i;
}
}
checkValue(document.getElementById(selectout));
}
</script>
line 130 add
<button type='button' id="filter2" onclick="searchreviewers('search2','users')"> Serach Committee Members</button>
<input type="text" id="search2" maxlength="80" onkeypress="handleKeyPress(event,this.form)" onkeyup="searchreviewers('search2','users')" >
http://localhost/admin/edu/pr_manage_new.php
Add "Undo Review is done"
copy admin/edu/submit_reviewDone.php to submit_undoreviewDone.php
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){
Subscribe to:
Posts (Atom)