If an email is configured for the cronjob, then all addresses in error will be printed out only once.

*********************************************************/
mb_internal_encoding("UTF-8");
$datafile = "data/.data.json.gz";
//the path yo your ZEND libs
set_include_path("/home/yurukov1/libs/");
include_once "Google_Spreadsheet.php";
include "secret.php";
include_once "config.php";
//access settings should be defined in config.php
$ss = new Google_Spreadsheet($u, $p);
$ss->useSpreadsheet($spreadsh);
$ss->useWorksheet($sheet);
// get the data from the spreadsheet
$rows = $ss->getRows();
if (!$rows) {
    exit;
}
$data = array();
for ($i = 0; $i < count($rows); $i++) {
    $type = $rows[$i]["искателидапомогнете"];
    if ($type == "Ще разпостранявам информация сред познати") {
        $type = 1;
    } else {
        if ($type == "Бих се заел с организиране на секция извън консулствата") {
            $type = 2;
        } else {
            $type = 0;
        }
    }
//headers
echo "<tr>";
$head = $ss->getColumnNames();
foreach ($head as $colname) {
    echo "<th>{$colname}</th>";
}
echo "</tr>";
//GET admin set
$view = $_GET["view"];
$rowset = "";
//means "show all;
if ($view == "Ongoing" || $view == "Completed" || $view == "Canceled" || $view == "Unknown") {
    $rowset = "projectstatus={$view}";
}
//retrieve data
$rows = $ss->getRows($rowset);
if ($rows) {
    foreach ($rows as $row) {
        echo "<tr>";
        $status = $row['projectstatus'];
        $title = $row['projecttitle'];
        $nrnbcontact = $row['nrnbcontact'];
        $email = str_replace(' ', '', $row['email']);
        $nrnbemail = str_replace(' ', '', $row['nrnbemail']);
        $subject = "Update Requested Regarding Your NRNB Collaboration: {$title}";
        $subid = $row['subprojectstatus'];
        $body = "This automatic email is sent to you based on the information submitted to http://nrnb.org regarding your collaboration with {$nrnbcontact} on the project: {$title}.%0D%0D\n\nOne of the primary roles of NRNB is to engage in a wide variety of collaboration and service projects around Cytoscape and other network biology tools. In our first few years as an organization, we have established close to 100 such collaborations, spanning 14 countries and 11 states -- including one with you! In preparation for our annual report and future funding renewal applications, we need YOUR help in justifying our existence.%0D%0D \n\nPlease take 5 minutes to update the status of your collaboration. We have prepared a custom form to collect a short paragraph and any new publication or grant numbers related to our work together. And if you have any general comments about impact of our collaboration on your research/career goals, please include those as well. %0D%0D\n\nProject Title: {$title}%0D\nCollaborator: {$nrnbcontact} (cc'd)%0D%0D\n\nLink to custom update form:%0D \nhttp://nrnb.org/csp.php?id={$subid}%0D%0D\n\nCollaborations are at the core of NRNB, providing a critical feedback loop in the development and dissemination of network biology tools. They clearly enrich our work and we hope they benefit you directly as well.%0D%0D\n\nThanks!%0D\n - Alex%0D%0D\n\n-----------------------------------%0D\nAlexander Pico, PhD%0D\nNRNB executive director%0D\napico@gladstone.ucsf.edu%0D\n415-734-2741%0D\n-----------------------------------\n";
        $pubs = $row['pubmedids'];
        $ifpubs = "";
        if (strlen($pubs) > 7) {
            $splitpubs = split(',', $pubs);
示例#3
0
     $status2 = check_input($_POST['status']);
     $st1 = check_input($_POST['stage1']);
     $st2 = check_input($_POST['stage2']);
     $st3 = check_input($_POST['stage3']);
     $st4 = check_input($_POST['stage4']);
     $stage2 = implode(",", array($st1, $st2, $st3, $st4));
     $uptime2 = date('n/j/Y G:i:s');
     $uprow = array('projectupdate' => $update2, 'collaborationfeedback' => $feedback2, 'pubmedids' => $pubmed2, 'grantids' => $grant2, 'projectstatus' => $status2, 'updatetimestamp' => $uptime2, 'projectstage' => $stage2);
     //UPDATE GOOGLE DOC
     if ($ss->updateRow($uprow, "subprojectstatus={$subid}")) {
         $msg = "<em><font color=\"green\">Data successfully updated!</font></em>";
     } else {
         $msg = "<em><font color=\"red\">Error, unable to update spreadsheet data.</font></em> <br />\n\t\t\tPlease try again or contact Alex at \n\t\t\t<a href=\"mailto:apico@gladstone.ucsf.edu?Subject=Error updating subproject {$subid}!\">apico@gladstone.ucsf.edu</a>";
     }
 }
 $rows = $ss->getRows("subprojectstatus={$subid}");
 if ($rows) {
     $names = $rows[0]['fullnamesanddegrees'];
     $inst = $rows[0]['departmentandinstitution'];
     $email = $rows[0]['email'];
     $url = $rows[0]['projecturl'];
     $nrnb = $rows[0]['nrnbcontact'];
     $nrnbemail = str_replace(' ', '', $rows[0]['nrnbemail']);
     $desc = $rows[0]['projectdescription'];
     $title = $rows[0]['projecttitle'];
     $type = $rows[0]['requesttype'];
     $oritime = $rows[0]['timestamp'];
     //UPDATE FIELDS
     $update = $rows[0]['projectupdate'];
     $uptime = $rows[0]['updatetimestamp'];
     $feedback = $rows[0]['collaborationfeedback'];
                array_push($stage2, substr($stage, $i, 1) . "2");
            }
            array_push($stage2, substr($stage, $len - 1, 1) . "1");
        }
        #print_r($stage2);
        ## get or add row to Stages and write cells
        $subid = "CSP-" . $row['subprojectstatus'];
        $nrnb = $row['nrnbcontact'];
        $title = $row['projecttitle'];
        $uprow = array('projecttitle' => $title, 'nrnbcontact' => $nrnb, 'subprojectstatus' => $subid);
        foreach ($stage2 as $st) {
            $col = "st" . $st;
            $uprow[$col] = $st;
        }
        ## UPDATE GOOGLE DOC
        $rowcheck = $ss2->getRows("subprojectstatus=\"{$subid}\"");
        if ($rowcheck) {
            if ($ss2->updateRow($uprow, "subprojectstatus=\"{$subid}\"")) {
                echo "Data successfully updated for subproject ID: {$subid}\n";
            } else {
                echo "Error, unable to update data for subproject ID: {$subid}\n";
            }
        } else {
            if ($ss2->addRow($uprow)) {
                echo "Data successfully added for subproject ID: {$subid}\n";
            } else {
                echo "Error, unable to add data for subproject ID: {$subid}\n";
            }
        }
    }
}
 function __construct()
 {
     new Model();
     $teamSpreadsheet = new Google_Spreadsheet('Team Contacts & Roles');
     // d($teamSpreadsheet);
     // $columnNames = $teamSpreadsheet->getColumnNames();
     // dd($columnNames);
     $this->rows = $teamSpreadsheet->getRows();
     // $rows = $teamSpreadsheet->getRows();
     // dd($rows);
     // foreach ($rows as $row) {
     // 	$teamName;
     // 	if (is_string($row)) {
     // 		$teamName = $row;
     // 	}
     // 	$data = array();
     // 	// $data = array_merge($row, $teamName);
     // 	$teamMember = new TeamMember($row);
     // 	$teamMember->setTeam($teamName);
     // 	// $teamMember = new TeamMember($teamName);
     // 	// foreach ($row as $key => $value) {
     // 	// 	$teamMember->set()
     // 	// 	$teamMember[] = $teamMember[$key] = $value;
     // 	// }
     // 	$this->teamMembers[] = $teamMember;
     // }
     // dd($teamMembers);
     // foreach ($rows as $row) {
     // 	// if row begins with '*' then trim it off and create a class with the name
     // 	// dd($row);
     // 	$count = 0;
     // 	$this->teamMembers[$count] = new TeamMember($row[0]);
     // 	// d($this->teamMembers);
     // 	foreach ($row as $k => $v) {
     // 		$this->teamMembers[$count]->setAll($v[0], $v[1], $v[2], $v[5], $v[6], $v[7], $v[8], $v[9]);
     // 		// d($row);
     // 		// sd($k);
     // 		// if ($k[0] == 'Position' && $k[9] == 'Picture') {
     // 		// }
     // 	}
     // 	$count++;
     // }
     // dd($teamMembers);
     // LOOP THROUGH AND CREATE TEAM MEMBERS
     // $teamMember = new TeamMember();
     // foreach ($rows as $colName => $colValue) {
     // for ($i = 0; $i < count($rows); $i++) {
     // 	$columnValues = array();
     // 	$columns = $rows[$i];
     // 	// for ($colPosition = 0; $colPosition < ; $colPosition++) {
     // 		// $columns[] = $rows[$i][$colPosition]
     // 	// }
     // 	foreach ($columns as $column) {
     // 		// dd($column);
     // 		// $columnValues[] =
     // 	}
     // }
     // $teams[] = new Team($currentFirstColumn);
     // - instantiate the Team Class
     // -
 }