Exemple #1
0
        $resultSet = $dbConn->Execute($sql);
        $new_prj_id = $resultSet->fields['prj_id'];
        $new_milestone = $resultSet->fields['milestone'];
        $sql = "BEGIN WORK;\n";
        $sql .= "DELETE FROM prj_grp WHERE prjtg_id in \n" . "(select prjtg_id from prj_tutor where prjm_id ={$new_prjm_id});\n";
        $sql .= "DELETE FROM prj_tutor WHERE prjm_id={$new_prjm_id};\n";
        $sql .= "INSERT INTO prj_tutor (grp_num,prjm_id,tutor_id,grp_name)\n" . " select o.grp_num,n.prjm_id,o.tutor_id,grp_name\n" . " from prj_milestone n cross join prj_tutor_builder o  where n.prjm_id={$new_prjm_id} and o.prjm_id={$prjm_id};\n";
        $sql .= "INSERT INTO prj_grp (snummer, prj_grp_open,written,prjtg_id)\n" . "select snummer,prj_grp_open,written,prjtg_id \n" . "from prj_grp_builder2 " . "where prjm_id={$new_prjm_id} and orig_prjm_id={$prjm_id};\n";
        $sql .= "INSERT into grp_alias (long_name,alias,website,productname,prjtg_id)\n" . "  SELECT n.long_name," . "coalesce(o.alias,'g'||n.grp_num::text) as alias,\n" . " o.website,o.productname,\n" . "  n.prjtg_id from grp_alias_builder o join \n" . "   grp_alias_builder n using (grp_num) where o.prjm_id={$prjm_id} and n.prjm_id={$new_prjm_id};\n";
        $sql .= "insert into project_roles\n" . "\t (prj_id,role,rolenum,capabilities,short)\n" . "\tselect {$new_prj_id},role,rolenum,capabilities,short from project_roles\n" . "\twhere prj_id={$prj_id} and " . "\t\t(({$new_prj_id},rolenum) not in (select prj_id,rolenum from project_roles));\n";
        $sql .= "INSERT INTO student_role (snummer,rolenum,capabilities,prjm_id)\n" . "\tselect  snummer,rolenum,capabilities,{$new_prjm_id} \n" . "from student_role\n" . " where prjm_id={$prjm_id};\n";
        $sql .= "commit;\n";
        //	$dbConn->log($sql);
        $dbConn->doOrDie($sql);
        // go to the dupped group.
        $prjSel->setPrjmId($new_prjm_id);
        extract($prjSel->getSelectedData());
        $_SESSION['prj_id'] = $prj_id;
        $_SESSION['prjm_id'] = $prjm_id;
        $_SESSION['milestone'] = $milestone;
    }
}
$prjm_id_selector = $prjSel->getWidget();
//getSelector();
$isAdmin = hasCap(CAP_SYSTEM) ? 'true' : 'false';
$sqlDup = "select p.afko||': '||p.description||'('||p.year||')'||' m'||pme.milestone||' (#'\n" . "||pme.prjm_id||')' as\n" . "name,\n\t pme.prjm_id as value" . " from project p\n" . "join prj_milestone pme on(pme.prj_id=p.prj_id) \n" . " where p.prj_id > 0 and '{$peer_id}'= owner_id and\n" . "( not exists (select * from prj_milestone pm \n" . "              join prj_tutor pt on (pm.prjm_id=pt.prjm_id) \n" . "           join prj_grp pg  on (pt.prjtg_id=pg.prjtg_id) \n" . "    where pm.prjm_id=pme.prjm_id))\n" . " and p.valid_until > now()::date" . " order by p.prj_id desc,pme.milestone";
// $dupSel=new PrjMilestoneSelector2($dbConn,$peer_id,$prjm_id);
// $dupSel->setWhere(" (not exists (select * from prj_grp where prjm_id=pm.prjm_id))" );
$dupPrjList = getOptionList($dbConn, $sqlDup, $prjm_id);
//$dbConn->log($sqlDup);
$sql = "select tutor,tutor_id from prj_tutor pt join tutor t on(t.userid=pt.tutor_id) where prjm_id={$prjm_id} and grp_num='{$grp_num}'";
Exemple #2
0
extract($_SESSION);
$productgrade = 7.0;
$prjSel = new PrjMilestoneSelector2($dbConn, $peer_id, $prjm_id);
$prjSel->setWhere("has_assessment=true");
extract($prjSel->getSelectedData());
if (isset($_REQUEST['prjtg_id'])) {
    $_SESSION['prjtg_id'] = $prjtg_id = validate($_REQUEST['prjtg_id'], 'integer', $prjtg_id);
    $sql = "select prj_id,milestone,prjm_id,grp_num,prjtg_id,tutor_grade as productgrade \n" . "from all_prj_tutor \n" . " where prjtg_id={$prjtg_id}";
    $resultSet = $dbConn->Execute($sql);
    if ($resultSet === false) {
        die("<br>Cannot get project name with <pre>\"" . $sql . '", cause ' . $dbConn->ErrorMsg() . "</pre><br/>");
    }
    if (!$resultSet->EOF) {
        extract($resultSet->fields);
    }
    $prjSel->setPrjmId($prjm_id);
    extract($prjSel->getSelectedData());
} else {
    $sql = "select 1 as t,prj_id,milestone,prjm_id,prjtg_id,grp_num,tutor_grade as productgrade from all_prj_tutor \n" . " where prjtg_id={$prjtg_id} and prjm_id={$prjm_id}\n" . " union \n" . " select 2 as t ,prj_id,milestone,prjm_id,prjtg_id,grp_num,tutor_grade as productgrade from all_prj_tutor\n" . " where prjm_id={$prjm_id} and grp_num=1\n" . " order by t,grp_num limit 1";
    $resultSet = $dbConn->Execute($sql);
    if ($resultSet === false) {
        die("<br>Cannot get project name with \"" . $sql . '", cause ' . $dbConn->ErrorMsg() . "<br>");
    }
    if (!$resultSet->EOF) {
        extract($resultSet->fields);
    }
    $prjSel->setPrjmId($prjm_id);
    extract($prjSel->getSelectedData());
}
$_SESSION['prj_id'] = $prj_id;
$_SESSION['prjm_id'] = $prjm_id;