コード例 #1
0
 public function Delete()
 {
     require_once dirname(__FILE__) . '/' . 'galleryimagecollection.php';
     $galleryimagecollection = new galleryimagecollection();
     foreach ($galleryimagecollection->Items as $item) {
         if ($item->position > $this->position) {
             $item->position -= 1;
             $item->Save();
         }
     }
     objectbase::Delete();
 }
コード例 #2
0
 public function Move($direction)
 {
     require_once dirname(__FILE__) . '/' . 'tickeritemcollection.php';
     //the method we're going to use is to swap the postion attrs:
     //of the selected item and the next or previous item
     $currentitempos = $this->position;
     //if direction = up: place the selected item at position one less than current
     $this->position = $direction == 'up' ? $currentitempos - 1 : $currentitempos + 1;
     $attrs['position'] = $direction == 'up' ? $currentitempos - 1 : $currentitempos + 1;
     $tickeritemcollection = new tickeritemcollection($attrs);
     if ($tickeritemcollection->Length == 1) {
         $tickeritemcollection->Items[0]->position = $direction == 'up' ? $tickeritemcollection->Items[0]->position + 1 : $tickeritemcollection->Items[0]->position - 1;
         $tickeritemcollection->Items[0]->Save();
         objectbase::Save();
     }
 }
コード例 #3
0
 public function Save()
 {
     //manually set the page name
     //for now only set page name if this page has never been published
     //this implies that the user can keep changing the name but only as long as the page has never been published
     if ($this->publishdate == '' || !isset($this->publishdate) || is_null($this->publishdate)) {
         $this->pagename = str_replace(' ', '-', $this->title);
         // Replaces all spaces with hyphens.
         $this->pagename = preg_replace('/[^A-Za-z0-9\\-]/', '', $this->pagename);
         // Removes special chars.
         $this->pagename = strtolower($this->pagename);
         $this->pagename .= '.php';
     }
     if (!$this->id) {
         $this->createdate = 'now()';
     }
     $this->modifieddate = 'now()';
     objectbase::Save();
 }
コード例 #4
0
 public function Save()
 {
     $retval = array();
     $retval['error'] = '';
     if (0 < $_FILES['file']['error']) {
         $retval['error'] = $_FILES['file']['error'];
     } else {
         $uploadfilename = $_FILES['file']['name'];
         $uniqueappend = '';
         $counter = 0;
         while (sizeof(glob('../../../images/' . pathinfo($uploadfilename)['filename'] . $uniqueappend . '.' . pathinfo($uploadfilename)['extension'])) > 0) {
             $counter += 1;
             $uniqueappend = '-' . $counter;
         }
         $uploadfilename = pathinfo($uploadfilename)['filename'] . $uniqueappend . '.' . pathinfo($uploadfilename)['extension'];
         move_uploaded_file($_FILES['file']['tmp_name'], '../../../images/' . $uploadfilename);
         $this->name = $uploadfilename;
         objectbase::Save();
     }
 }
コード例 #5
0
 public function Save()
 {
     require_once 'dataobjectserver/application.php';
     $application = Application::getinstance();
     // piaggregate -> aggregatecolumn -> aggregateitem -> tag
     // first drill down to the aggregateitem
     for ($i = 0; $i < sizeof($this->aggregatecolumn); $i++) {
         $aggregatecolumnjson = $this->aggregatecolumn[$i];
         //cast the json object to a well formed php object based on the data object model
         $aggregatecolumn = $application->GetObjectForJSON($aggregatecolumnjson, 'aggregatecolumn');
         for ($j = 0; $j < sizeof($aggregatecolumn->aggregateitem); $j++) {
             $aggregateitemjson = $aggregatecolumn->aggregateitem[$j];
             $aggregateitem = $application->GetObjectForJSON($aggregateitemjson, 'aggregateitem');
             $aggregateitem->aggregateitemtype[0] = $application->GetObjectForJSON($aggregateitem->aggregateitemtype[0], 'aggregateitemtype');
             $aggregateitem->position = $j + 1;
             $aggregateitem->Save();
             $aggregatecolumn->aggregateitem[$j] = $aggregateitem;
         }
         $aggregatecolumn->position = $i + 1;
         $aggregatecolumn->Save();
         $this->aggregatecolumn[$i] = $aggregatecolumn;
     }
     objectbase::Save();
 }
コード例 #6
0
 public function Save()
 {
     $this->subtitle = substr(strip_tags($this->body), 0, 220);
     objectbase::Save();
 }