当前位置: 首页>>代码示例>>PHP>>正文


PHP data::name方法代码示例

本文整理汇总了PHP中data::name方法的典型用法代码示例。如果您正苦于以下问题:PHP data::name方法的具体用法?PHP data::name怎么用?PHP data::name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在data的用法示例。


在下文中一共展示了data::name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update_details_global

function update_details_global($contest, $contest_id, $contest_type, $cid)
{
    //adding contest details
    //creating object of api
    echo "inside update global details ";
    $provider = "hackerearth";
    $api_table = new api_table();
    $api = new api($api_table->get_api_url($provider), $api_table->get_client_id($provider), $api_table->get_client_secret($provider));
    $json_data = $api->connect_api($contest_id);
    //creating object of data for getting valuable information from json data
    $data = new data();
    $coders_size = $data->coders_participated($json_data);
    echo $coders_size;
    if ($coders_size == 0) {
        die("Problem in connection with hackererth api : Reload to try again ");
    }
    //creating object of coders main table
    //$coders = new coders();
    //creating object of coders rating table
    //$rating = new rating();
    //check for tables if not present then create them
    $candidate = new candidate_api($api_table->get_client_id($provider), $api_table->get_client_secret($provider));
    $coders = new coders();
    $rating = new rating();
    //$res=$candidate->connect_api(11902,"harshitdd120@gmail.com");
    //looping to add new coders details
    $candidates_data = array();
    $index = 0;
    for ($i = 0; $i < $coders_size; $i++) {
        $hacker_id = $data->hacker_id($json_data, $i);
        $name = $data->name($json_data, $i);
        $email = $data->email($json_data, $i);
        $res = $candidate->connect_api($contest_id, $email);
        $institute = $data->institute($res);
        $pos1 = strpos($institute, "silchar");
        $pos2 = strpos($institute, "sichar");
        if ($pos1 != false || $pos2 != false) {
            $candidates_data[$index]['hacker_id'] = $hacker_id;
            $candidates_data[$index]['name'] = $name;
            $index++;
            echo 1 + $index . " " . $name . "<br>";
            if (!$coders->is_coder_present($hacker_id)) {
                $coders->add_new_coder($hacker_id, $name);
                echo "new coder added " . $name . "<br>";
            }
        }
        //if(!$coders->is_coder_present($hacker_id)){
        //	$coders->add_new_coder($hacker_id,$name);
        //$rating->add_new_coder($hacker_id);
        //echo "new coder added ".$name."<br>";
    }
    echo "<pre>";
    print_r($candidates_data);
    $rating_val = array();
    for ($i = 0; $i < $index; $i++) {
        $hacker_id = $candidates_data[$i]['hacker_id'];
        $rate = $coders->get_final_rating($hacker_id);
        $rating_val[$hacker_id] = $rate;
    }
    echo "<pre>";
    print_r($rating_val);
    //array storing new calculated seed values
    $seed = seed($rating_val, $index, $coders);
    echo "<pre>";
    print_r($seed);
    //array for storing new rating values
    $new_rating = array();
    for ($i = 0; $i < $index; $i++) {
        $hacker_id = $candidates_data[$i]['hacker_id'];
        $new_rating[$hacker_id] = new_rating($seed[$hacker_id], $i + 1, $contest_type, $rating_val[$hacker_id], $index);
    }
    echo "<pre>";
    print_r($new_rating);
    //adding a new column in coders rating table
    //updating new rating for each participated contest
    foreach ($new_rating as $key => $value) {
        $uid = $coders->get_uid($key);
        $coders->update_rating($key, $value);
        $rating->insert_new_rating($cid, $uid, $value);
        //echo "rating updated";
    }
    //updating new coders to old
    $coders->new_to_old();
    //updating that contest is evaluated
    $contest->rate_contest($contest_id);
    //header('Location:../pages/viewUsers.php');
}
开发者ID:CCNITSilchar,项目名称:hof.ccnits.com,代码行数:87,代码来源:evaluate_contest.php


注:本文中的data::name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。