90 lines
1.9 KiB
PHP
90 lines
1.9 KiB
PHP
<?php
|
|
/**
|
|
* The model file of gitlab module of ZenTaoPMS.
|
|
*
|
|
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
|
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
|
* @author Chenqi <chenqi@cnezsoft.com>
|
|
* @package product
|
|
* @version $Id: $
|
|
* @link http://www.zentao.net
|
|
*/
|
|
|
|
class gitlabModel extends model
|
|
{
|
|
/**
|
|
* Get a gitlab by id.
|
|
*
|
|
* @param int $id
|
|
* @access public
|
|
* @return object
|
|
*/
|
|
public function getByID($id)
|
|
{
|
|
return $this->loadModel('pipeline')->getByID($id);
|
|
}
|
|
|
|
/**
|
|
* Get gitlab list.
|
|
*
|
|
* @param string $orderBy
|
|
* @param object $pager
|
|
* @access public
|
|
* @return array
|
|
*/
|
|
public function getList($orderBy = 'id_desc', $pager = null)
|
|
{
|
|
return $this->loadModel('pipeline')->getList('gitlab', $orderBy, $pager);
|
|
}
|
|
|
|
/**
|
|
* Get gitlab pairs
|
|
*
|
|
* @return array
|
|
*/
|
|
public function getPairs()
|
|
{
|
|
return $this->loadModel('pipeline')->getPairs('gitlab');
|
|
}
|
|
|
|
/**
|
|
* Create a gitlab.
|
|
*
|
|
* @access public
|
|
* @return bool
|
|
*/
|
|
public function create()
|
|
{
|
|
return $this->loadModel('pipeline')->create('gitlab');
|
|
}
|
|
|
|
/**
|
|
* Update a gitlab.
|
|
*
|
|
* @param int $id
|
|
* @access public
|
|
* @return bool
|
|
*/
|
|
public function update($id)
|
|
{
|
|
return $this->loadModel('pipeline')->update($id);
|
|
}
|
|
|
|
/**
|
|
* Get gitlab token permissions.
|
|
*
|
|
* @param string $host
|
|
* @param string $token
|
|
* @access public
|
|
* @return array
|
|
*/
|
|
public function getPermissionsByToken($host, $token)
|
|
{
|
|
$host = rtrim($host, '/');
|
|
$host .= '/api/v4/activities';
|
|
$results = json_decode(file_get_contents($host . "?private_token=$token"));
|
|
|
|
return $results;
|
|
}
|
|
}
|