public function __construct($data = array())
 {
     parent::__construct($data);
     $this->site = opPluginChannelServerToolkit::getConfig('related_redmine_base_url', 'http://redmine.openpne.jp/');
     $this->request_format = 'xml';
     $this->element_name = 'users';
 }
Example #2
0
 /**
  * Get the plural name for a class.
  */
 public static function plural_name($name)
 {
     if (isset($name::$plural_name)) {
         return $name::$plural_name;
     }
     if (strpos($name, '\\') !== false) {
         $name = substr($name, strrpos($name, '\\') + 1);
     }
     $ar = new ActiveResource();
     return $ar->pluralize($name);
 }
Example #3
0
 /**
  * Prepare a resource $resource to call to its find method.
  *
  * @param \ActiveResource $resource
  * @param mixed $id
  * @param array $filter
  * @param array $sort
  * @param mixed $offset
  * @param mixed $limit
  * @return object
  */
 private function find($resource, $id, $filter = array(), $sort = array(), $offset = null, $limit = null)
 {
     $id = $id == null ? 'all' : $id;
     if (count($sort) > 0) {
         $filter['sort'] = $this->prepareSortField($sort);
     }
     if ($offset !== NULL && is_int($offset)) {
         $filter['offset'] = $offset;
     }
     if ($limit !== NULL && is_int($limit)) {
         $filter['limit'] = $limit;
     }
     return $resource->find($id, $filter);
 }
Example #4
0
if (!isset($_SERVER['argv'][2])) {
    Cli::block($usage);
    die;
}
$types = array('checkbox', 'date', 'datetime', 'email', 'password', 'pkey', 'radio', 'select', 'text', 'textarea', 'time', 'wysiwyg');
if ($_SERVER['argv'][2] === 'list-types') {
    Cli::out(' - ' . join("\n - ", $types), 'info');
    die;
}
if (!isset($_SERVER['argv'][3])) {
    Cli::block($usage);
    die;
}
$name = strtolower($_SERVER['argv'][2]);
// get plural name
$ar = new ActiveResource();
$plural = $ar->pluralize($name);
unset($ar);
if (file_exists('apps/' . $plural)) {
    Cli::out('apps/' . $plural . ' already exists.  Please choose a different name for your new app.', 'info');
    die;
}
// build list of fields
$fields = array();
$pkey = false;
for ($i = 3; $i < count($_SERVER['argv']); $i++) {
    // match name:type
    if (preg_match('/^([a-zA-Z0-9_]+):(' . join('|', $types) . ')$/', $_SERVER['argv'][$i], $regs)) {
        $fields[] = (object) array('name' => $regs[1], 'type' => $regs[2]);
        if ($regs[2] === 'pkey') {
            $pkey = $regs[1];