예제 #1
0
     $bx->box_columns_end();
     $bx->box_body_end();
     $bx->box_end();
 }
 if (is_developer($auth->auth["uname"]) && $auth->auth["perm"] != "devel_pending" && $auth->auth["perm"] != "editor" && $auth->auth["perm"] != "admin" && $auth->auth["perm"] != "editor,admin") {
     $bx->box_begin();
     $bx->box_body_begin();
     $bx->box_columns_begin(3, 'top');
     $bx->box_column_start("right", "34%", "");
     personal_consultants($auth->auth["uname"], "A");
     $bx->box_column_finish();
     $bx->box_column_start("right", "33%", "");
     personal_consultants($auth->auth["uname"], "P");
     $bx->box_column_finish();
     $bx->box_column_start("right", "33%", "");
     personal_consultants($auth->auth["uname"], "R");
     $bx->box_column_finish();
     $bx->box_columns_end();
     $bx->box_body_end();
     $bx->box_end();
     $bx->box_begin();
     $bx->box_body_begin();
     $bx->box_columns_begin(3, 'top');
     $bx->box_column_start("right", "34%", "");
     personal_referees($auth->auth["uname"], "A");
     $bx->box_column_finish();
     $bx->box_column_start("right", "33%", "");
     personal_referees($auth->auth["uname"], "P");
     $bx->box_column_finish();
     $bx->box_column_start("right", "33%", "");
     personal_referees($auth->auth["uname"], "R");
 function testPersonal_consultants()
 {
     global $bx;
     $user1 = "fubar";
     $status1 = "D";
     $user2 = "snafu";
     $status2 = "A";
     $user3 = "fritz";
     $status3 = "R";
     $db_config = new mock_db_configure(3);
     $db_q = "SELECT * FROM consultants,description WHERE " . "consultant='%s' AND consultants.status" . "='%s' AND consultants.proid=" . "description.proid";
     $db_config->add_query(sprintf($db_q, $user1, $status1), 0);
     $db_config->add_query(sprintf($db_q, $user2, $status2), 1);
     $db_config->add_query(sprintf($db_q, $user3, $status3), 2);
     $db_config->add_num_row(0, 0);
     $db_config->add_num_row(1, 1);
     $db_config->add_num_row(2, 2);
     $cols = array('status', 'proid', 'project_title');
     // this is for the snafu query
     $row1 = $this->_generate_array($cols, 1);
     $db_config->add_record($row1, 1);
     $db_config->add_record(false, 1);
     // this is for the fritz query
     $row2 = $this->_generate_array($cols, 2);
     $db_config->add_record($row2, 2);
     $row3 = $this->_generate_array($cols, 3);
     $db_config->add_record($row3, 2);
     $db_config->add_record(false, 2);
     //
     // fubar query
     //
     $bx = $this->_create_default_box();
     capture_reset_and_start();
     // here next_record will not be called
     personal_consultants($user1, $status1);
     $this->set_text(capture_stop_and_get());
     $this->set_msg('test 1');
     $this->_testFor_string_length(716);
     // check title string
     $this->_testFor_pattern("Consultant [(]" . show_status($status1) . "[)]");
     $this->_testFor_pattern("No consultant proposal with this " . "status\n");
     //
     // snafu query
     //
     $bx = $this->_create_default_box();
     capture_reset_and_start();
     // here next_record will not be called
     personal_consultants($user2, $status2);
     $this->set_text(capture_stop_and_get());
     $this->set_msg('test 2');
     $this->_testFor_string_length(777);
     // check title string
     $this->_testFor_pattern("Consultant [(]" . show_status($status2) . "[)]");
     $this->_testFor_consultant_project_link($row1['proid'], $row1['project_title'], $row1['status']);
     //
     // fubar query
     //
     $bx = $this->_create_default_box();
     capture_reset_and_start();
     // here next_record will not be called
     personal_consultants($user3, $status3);
     $this->set_text(capture_stop_and_get());
     $this->set_msg('test 3');
     $this->_testFor_string_length(877);
     // check title string
     $this->_testFor_pattern("Consultant [(]" . show_status($status3) . "[)]");
     $this->_testFor_consultant_project_link($row2['proid'], $row2['project_title'], $row2['status']);
     $this->_testFor_consultant_project_link($row3['proid'], $row3['project_title'], $row3['status']);
     // if using a database, then ensure that it didn't fail
     $this->_check_db($db_config);
 }