예제 #1
0
파일: smsadd.php 프로젝트: Akrobate/akrocrm
 /**
  *	Surchage principale
  *
  */
 public function init()
 {
     $orm = new OrmNode();
     $fields = OrmNode::getFieldsFor($this->getModule());
     $data = array();
     $data['mobilephone'] = request::get('phone');
     $data['message'] = request::get('text');
     $id_contact = $this->tryToAttach('contacts', $data['mobilephone']);
     print_r($id_contact);
     if ($id_contact != 0) {
         $data['id_contact'] = $id_contact;
     }
     $allFields = array_keys($fields);
     $rez = $orm->upsert($this->getModule(), $allFields, $data);
     // On est en mode "Pseudo API" donc je kill l'execution a la fin volontairement
     exit;
 }
예제 #2
0
파일: save.php 프로젝트: Akrobate/akrocrm
 public function init()
 {
     $id = request::get('id');
     $orm = new OrmNode();
     $fields = OrmNode::getFieldsFor($this->getModule());
     $data = array();
     foreach ($fields as $fieldname => $field) {
         $data[$fieldname] = request::get($fieldname);
     }
     $allFields = array_keys($fields);
     if ($id != "") {
         $allFields[] = 'id';
         $data['id'] = $id;
     }
     $rez = $orm->upsert($this->getModule(), $allFields, $data);
     //		print_r($rez);
     if ($rez['id'] != 0) {
         $id = $rez['id'];
     }
     //echo("========" . $id);
     url::redirect($this->getModule(), 'view', $id);
 }
예제 #3
0
        $toinclude = PATH_MODULES . $dir . PATH_SEP . "fields.php";
        include $toinclude;
        for ($j = 0; $j < $nbr_items_per_table + 100; $j++) {
            $data = DataNode::peopleTableContacts($dir, $fields);
            $obj = new OrmNode();
            $allFields = array_keys($fields);
            $obj->upsert($dir, $allFields, $data);
            print_r($data);
        }
    }
    // Création de toutes les jointures
    $fields = OrmNode::getFieldsFor($dir);
    foreach ($fields as $name => $field) {
        if ($field['type'] == 'join') {
            $joinmodule = $field['join']['table'];
            $orm = new OrmNode();
            $alldata = $orm->getAllData($joinmodule, array('id' => 'id'));
            foreach ($alldata as $d) {
                $randjoin = rand(1, $nbr_items_per_table);
                $fields1 = OrmNode::getFieldsFor($dir);
                $data = array();
                $data[$name] = $randjoin;
                $allFields = array();
                $allFields[] = $name;
                $allFields[] = 'id';
                $data['id'] = $d['id'];
                $rez = $orm->upsert($dir, $allFields, $data);
            }
        }
    }
}