• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP process_widget函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中process_widget函数的典型用法代码示例。如果您正苦于以下问题:PHP process_widget函数的具体用法?PHP process_widget怎么用?PHP process_widget使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: processView

 function processView()
 {
     if (empty($_REQUEST['planid'])) {
         add_message('No plans selected for execution', 'error');
         return;
     }
     if (empty($_REQUEST['personid'])) {
         add_message('No persons selected for plan execution', 'error');
         return;
     }
     $plans = array();
     foreach ($_REQUEST['planid'] as $planid) {
         $plans[] = $GLOBALS['system']->getDBObject('action_plan', $planid);
     }
     $refdate = process_widget('plan_reference_date', array('type' => 'date'));
     foreach ($_REQUEST['personid'] as $personid) {
         foreach ($plans as $plan) {
             $plan->execute('person', (int) $personid, $refdate);
         }
     }
     foreach ($plans as $plan) {
         add_message('"' . $plan->getValue('name') . '" plan executed for ' . count($_REQUEST['personid']) . ' person(s)', 'success');
     }
     if (count($_REQUEST['personid']) == 1) {
         redirect('persons', array('personid' => (int) reset($_REQUEST['personid'])));
     }
 }
开发者ID:vanoudt,项目名称:jethro-pmm,代码行数:27,代码来源:view_0_execute_plans.class.php


示例2: processView

 function processView()
 {
     $this->_family =& $GLOBALS['system']->getDBObject('family', $_REQUEST['familyid']);
     $GLOBALS['system']->includeDBClass('person');
     $this->_person = new Person();
     if (array_get($_REQUEST, 'new_person_submitted')) {
         $GLOBALS['system']->doTransaction('begin');
         $this->_person = new Person();
         $this->_person->processForm();
         $this->_person->setValue('familyid', $this->_family->id);
         if ($this->_person->create()) {
             if (!empty($_POST['execute_plan'])) {
                 foreach ($_POST['execute_plan'] as $planid) {
                     $plan = $GLOBALS['system']->getDBObject('action_plan', $planid);
                     $plan->execute('person', $this->_person->id, process_widget('plan_reference_date', array('type' => 'date')));
                 }
             }
             $GLOBALS['system']->doTransaction('commit');
             add_message('New family member added');
             redirect('families', array('familyid' => $this->_family->id));
             // exits
         } else {
             $GLOBALS['system']->doTransaction('rollback');
         }
     } else {
         $this->_person->setValue('last_name', $this->_family->getValue('family_name'));
     }
 }
开发者ID:howardgrigg,项目名称:jethro-pmm,代码行数:28,代码来源:view_0_add_person_to_family.class.php


示例3: processView

 function processView()
 {
     if (empty($_REQUEST['params_submitted'])) {
         if (!empty($_SESSION['attendance'])) {
             $this->age_bracket = array_get($_SESSION['attendance'], 'age_bracket');
             $this->congregationids = array_get($_SESSION['attendance'], 'congregationids');
             $this->groupid = array_get($_SESSION['attendance'], 'groupid');
             $this->start_date = array_get($_SESSION['attendance'], 'start_date', date('Y-m-d', strtotime('-7 weeks')));
             $this->end_date = array_get($_SESSION['attendance'], 'end_date');
         } else {
             $this->start_date = date('Y-m-d', strtotime('-7 weeks'));
         }
     } else {
         $this->age_bracket = $_SESSION['attendance']['age_bracket'] = $_REQUEST['age_bracket'];
         if ($this->age_bracket != '') {
             $this->age_bracket = (int) $this->age_bracket;
         }
         if (!empty($_REQUEST['congregationid']) && is_array($_REQUEST['congregationid'])) {
             foreach ($_REQUEST['congregationid'] as $congid) {
                 $this->congregationids[] = (int) $congid;
             }
             $_SESSION['attendance']['congregationids'] = $this->congregationids;
         }
         $this->groupid = $_SESSION['attendance']['groupid'] = array_get($_REQUEST, 'groupid');
         $this->start_date = $_SESSION['attendance']['start_date'] = process_widget('start_date', array('type' => 'date'));
         $this->end_date = $_SESSION['attendance']['end_date'] = process_widget('end_date', array('type' => 'date'));
     }
     // Make sure there are no empty congregation IDs, except the first one
     for ($i = count($this->congregationids); $i > 0; $i--) {
         if (empty($this->congregationids[$i])) {
             unset($this->congregationids[$i]);
         }
     }
 }
开发者ID:samrae,项目名称:jethro-pmm,代码行数:34,代码来源:view_6_attendance__2_display.class.php


示例4: processView

 function processView()
 {
     $this->_start_date = process_widget('start_date', array('type' => 'date'));
     $this->_end_date = process_widget('end_date', array('type' => 'date'));
     if (is_null($this->_end_date)) {
         $this->_end_date = date('Y-m-d', strtotime(date('Y-m-01') . ' -1 day'));
     }
     if (is_null($this->_start_date)) {
         $this->_start_date = date('Y-m-d', strtotime($this->_start_date . '  -3 months'));
     }
 }
开发者ID:vanoudt,项目名称:jethro-pmm,代码行数:11,代码来源:view_6_attendance__3_statistics.class.php


示例5: processView

 function processView()
 {
     $GLOBALS['system']->includeDBClass('service');
     $this->_service_date = process_widget('service_date', array('type' => 'date'));
     $this->_congregations = $GLOBALS['system']->getDBObjectData('congregation', array('!meeting_time' => ''));
     if (empty($this->_congregations)) {
         add_message("You need to set the 'code name' for some of your congregations before using this feature", 'failure');
         $this->_congregations = NULL;
         // mark that we neve had any even before processing
         return;
     }
     $this->_dirs['populate'] = SERVICE_DOCS_TO_POPULATE_DIRS ? explode('|', SERVICE_DOCS_TO_POPULATE_DIRS) : '';
     $this->_dirs['expand'] = SERVICE_DOCS_TO_EXPAND_DIRS ? explode('|', SERVICE_DOCS_TO_EXPAND_DIRS) : '';
     if (empty($this->_dirs['populate']) && empty($this->_dirs['expand'])) {
         add_message("You need to set a value for SERVICE_DOCS_TO_POPULATE_DIRS or SERVICE_DOCS_TO_EXPAND_DIRS in your system configuration before using this feature", 'failure');
         $this->_dirs = NULL;
         return;
     }
     // Convert relative path names to absolute, and warn of non-existent folders
     $rootpath = DOCUMENTS_ROOT_PATH ? DOCUMENTS_ROOT_PATH : JETHRO_ROOT . '/files';
     foreach (array('populate', 'expand') as $dirtype) {
         foreach ($this->_dirs[$dirtype] as $i => &$dir) {
             if (!is_dir($dir)) {
                 if (is_dir($rootpath . '/' . $dir)) {
                     $dir = $rootpath . '/' . $dir;
                 } else {
                     add_message("The folder " . $this->_cleanDirName($dir) . ' was not found and will not be used.  Check your system config file.', 'warning');
                     unset($this->_dirs[$dirtype][$i]);
                 }
             }
         }
     }
     unset($dir);
     // foreach by ref is dangerous.
     if ($this->_service_date) {
         switch (array_get($_REQUEST, 'action')) {
             case 'initiate':
                 $this->processInitiate();
                 break;
             case 'populate':
                 $this->processPopulate();
                 break;
             case 'expand':
                 $this->processExpand();
                 break;
         }
     }
 }
开发者ID:samrae,项目名称:jethro-pmm,代码行数:48,代码来源:view_8_services__5_generate_documents.class.php


示例6: processView

 function processView()
 {
     $this->editing = !empty($_REQUEST['editing']) && $GLOBALS['user_system']->havePerm(PERM_EDITSERVICE);
     if (!empty($_REQUEST['congregationid'])) {
         $this->congregationid = (int) $_REQUEST['congregationid'];
     }
     $this->date = process_widget('date', array('type' => 'date'));
     if (empty($this->date) && !empty($_SESSION['service_date'])) {
         $this->date = $_SESSION['service_date'];
     }
     if (empty($this->congregationid) && !empty($_SESSION['service_congregationid'])) {
         $this->congregationid = $_SESSION['service_congregationid'];
     }
     if ($this->congregationid && $this->date) {
         $_SESSION['service_date'] = $this->date;
         $_SESSION['service_congregationid'] = $this->congregationid;
         $this->service = NULL;
         $serviceData = $GLOBALS['system']->getDBOBjectData('service', array('congregationid' => $this->congregationid, 'date' => $this->date), 'AND');
         if (!empty($serviceData)) {
             // SAVE RUN SHEET
             $this->service = $GLOBALS['system']->getDBObject('service', key($serviceData));
             if ($this->editing) {
                 $this->service->acquireLock('items');
             }
             if (!empty($_REQUEST['save_service']) && $GLOBALS['user_system']->havePerm(PERM_EDITSERVICE)) {
                 if (!$this->service->haveLock('items')) {
                     trigger_error("Your lock expired and your changes could not be saved");
                     return;
                 }
                 $newItems = array();
                 foreach (array_get($_POST, 'componentid', array()) as $rank => $compid) {
                     $newItem = array('componentid' => $compid, 'title' => $_POST['title'][$rank], 'personnel' => $_POST['personnel'][$rank], 'show_in_handout' => $_POST['show_in_handout'][$rank], 'length_mins' => $_POST['length_mins'][$rank], 'note' => trim($_POST['note'][$rank]), 'heading_text' => trim($_POST['heading_text'][$rank]));
                     $newItems[] = $newItem;
                 }
                 $this->service->saveItems($newItems);
                 $this->service->saveComments(process_widget('service_comments', array('type' => 'html')));
                 $this->service->releaseLock('items');
                 $this->editing = FALSE;
             }
         }
     } else {
         $this->date = date('Y-m-d', strtotime('Sunday'));
     }
 }
开发者ID:vanoudt,项目名称:jethro-pmm,代码行数:44,代码来源:view_8_services.class.php


示例7: processView

 function processView()
 {
     $this->_start_date = process_widget('start_date', array('type' => 'date'));
     if (is_null($this->_start_date)) {
         if (!empty($_SESSION['roster_start_date'])) {
             $this->_start_date = $_SESSION['roster_start_date'];
         } else {
             $this->_start_date = date('Y-m-d');
         }
     }
     $this->_end_date = process_widget('end_date', array('type' => 'date'));
     if (is_null($this->_end_date)) {
         if (!empty($_SESSION['roster_end_date'])) {
             $this->_end_date = $_SESSION['roster_end_date'];
         } else {
             $this->_end_date = date('Y-m-d', strtotime('+' . ROSTER_WEEKS_DEFAULT . ' weeks'));
         }
     }
     if (!empty($_REQUEST['viewid'])) {
         $this->_view = $GLOBALS['system']->getDBObject('roster_view', (int) $_REQUEST['viewid']);
     }
     $_SESSION['roster_start_date'] = $this->_start_date;
     $_SESSION['roster_end_date'] = $this->_end_date;
 }
开发者ID:howardgrigg,项目名称:jethro-pmm,代码行数:24,代码来源:view_7_rosters__1_display_roster_assignments.class.php


示例8: processDatesInterface

 static function processDatesInterface($prefix)
 {
     $res = NULL;
     if (!empty($_POST[$prefix . 'date'])) {
         $res = array();
         $date_params = array('type' => 'date', 'allow_blank_year' => true);
         foreach ($_POST[$prefix . 'date'] as $i => $d) {
             $d['date'] = process_widget($prefix . 'dateval[' . $i . ']', $date_params);
             if (empty($d['date'])) {
                 continue;
             }
             if (empty($d['typeid'])) {
                 $d['typeid'] = NULL;
             }
             if (empty($d['typeid']) && !strlen($d['note'])) {
                 add_message('The date "' . format_date($d['date']) . '" was not saved because no type or note was specified for it');
             } else {
                 // we only save each dateval+type combo once.  entries with notes win.
                 $res[] = $d;
             }
         }
     }
     return $res;
 }
开发者ID:samrae,项目名称:jethro-pmm,代码行数:24,代码来源:person.class.php


示例9: processFieldInterface

 public function processFieldInterface($name, $prefix = '')
 {
     if (!$this->id || $this->haveLock()) {
         $value = process_widget($prefix . $name, $this->fields[$name]);
         if (!is_null($value)) {
             $this->setValue($name, $value);
         }
     }
 }
开发者ID:samrae,项目名称:jethro-pmm,代码行数:9,代码来源:db_object.class.php


示例10: process_widget

function process_widget($name, $params, $index = NULL, $preserveEmpties = FALSE)
{
    $testVal = $rawVal = array_get($_REQUEST, $name);
    if (empty($testVal) && $params['type'] == 'date') {
        $testVal = array_get($_REQUEST, $name . '_d');
    }
    if (is_array($testVal) && $params['type'] != 'bitmask' && array_get($params, 'allow_multiple', 0) == 0) {
        if (!is_null($index)) {
            $rawVal = $rawVal[$index];
        } else {
            $res = array();
            foreach ($testVal as $i => $v) {
                $x = process_widget($name, $params, $i);
                if ($preserveEmpties || strlen($x)) {
                    $res[] = $x;
                }
            }
            return $res;
        }
    }
    $value = null;
    switch ($params['type']) {
        case 'phone':
            if (array_get($params, 'allow_empty', TRUE) && empty($rawVal)) {
                $value = '';
            } else {
                if (!is_valid_phone_number($rawVal, $params['formats'])) {
                    trigger_error('The phone number "' . $rawVal . '" is not valid and has not been set', E_USER_NOTICE);
                    $value = NULL;
                } else {
                    $value = clean_phone_number($rawVal);
                }
            }
            break;
        case 'date':
            if (isset($rawVal)) {
                // might have an ISO8601 date
                if (preg_match('/^(\\d\\d\\d\\d-\\d\\d-\\d\\d)$/', $rawVal)) {
                    return $rawVal;
                }
            }
            if (FALSE === strpos($name, '[')) {
                $subindex = NULL;
            } else {
                $subindex = substr($name, strpos($name, '[') + 1, strpos($name, ']') - strpos($name, '[') - 1);
                $name = substr($name, 0, strpos($name, '['));
            }
            if (!isset($_REQUEST[$name . '_d'])) {
                return NULL;
            }
            if (!is_null($subindex) && !isset($_REQUEST[$name . '_d'][$subindex])) {
                return NULL;
            }
            foreach (array('y', 'm', 'd') as $comp) {
                $comp_vals[$comp] = array_get($_REQUEST, $name . '_' . $comp, 0);
                if (!is_null($index)) {
                    $comp_vals[$comp] = $comp_vals[$comp][$index];
                }
                if (!is_null($subindex)) {
                    $comp_vals[$comp] = $comp_vals[$comp][$subindex];
                }
            }
            $value = sprintf('%04d-%02d-%02d', $comp_vals['y'], $comp_vals['m'], $comp_vals['d']);
            if ($value == '0000-00-00') {
                return NULL;
            }
            if ($value == '0000-01-00') {
                return NULL;
            }
            if (array_get($params, 'allow_blank_year') && !(int) $comp_vals['y']) {
                $value = substr($value, 4);
                if (date('-m-d', strtotime('2000' . $value)) != $value) {
                    trigger_error('The date "' . $value . '" is not valid and has not been set', E_USER_NOTICE);
                    $value = NULL;
                }
            } else {
                if (date('Y-m-d', strtotime($value)) != $value) {
                    trigger_error('The date "' . $value . '" is not valid and has not been set', E_USER_NOTICE);
                    $value = NULL;
                }
            }
            break;
        case 'bibleref':
            if (!empty($rawVal)) {
                require_once 'bible_ref.class.php';
                $br = new bible_ref($rawVal);
                if ($br->book) {
                    $value = $br->toCode();
                }
            }
            break;
        case 'bitmask':
            // value is the bitwise-or of all submitted values
            $value = 0;
            if (isset($rawVal)) {
                foreach ((array) $rawVal as $i) {
                    $value = $value | (int) $i;
                }
            }
            break;
//.........这里部分代码省略.........
开发者ID:vanoudt,项目名称:jethro-pmm,代码行数:101,代码来源:general.php


示例11: _processRuleDetails

 function _processRuleDetails($field)
 {
     $res = array();
     switch ($this->_field_details[$field]['type']) {
         case 'datetime':
             $res['from'] = process_widget('params_' . str_replace('.', '_', $field) . '_from', array('type' => 'date'));
             $res['to'] = process_widget('params_' . str_replace('.', '_', $field) . '_to', array('type' => 'date'));
             break;
         case 'select':
         case 'reference':
             $res = $this->_removeEmpties(array_get($_POST, 'params_' . str_replace('.', '_', $field), array()));
             break;
         default:
             $res = array_get($_POST, 'params_' . str_replace('.', '_', $field));
             break;
     }
     return $res;
 }
开发者ID:brightmore,项目名称:jethro-pmm,代码行数:18,代码来源:person_query.class.php


示例12: processNoteFieldWidgets

 /**
  * Process the interface for POPULATING fields within this note template
  * (used when adding a note to a person)
  */
 public function processNoteFieldWidgets()
 {
     $fields = $GLOBALS['system']->getDBObjectData('note_template_field', array('templateid' => $this->id), 'OR', 'rank');
     foreach ($fields as $id => $details) {
         if ($details['customfieldid']) {
             $cf = $GLOBALS['system']->getDBObject('custom_field', $details['customfieldid']);
             $this->_field_values[$id] = $cf->processWidget();
         } else {
             $params = unserialize($details['params']);
             $params['type'] = $details['type'];
             $this->_field_values[$id] = process_widget('template_field_' . $id, $params);
         }
     }
 }
开发者ID:vanoudt,项目名称:jethro-pmm,代码行数:18,代码来源:note_template.class.php


示例13: processView

 public function processView()
 {
     if (!count(self::getCongregations())) {
         add_message("You need to set the 'code name' for some of your congregations before using this feature", 'failure');
         return;
     }
     $this->_service_date = process_widget('date', array('type' => 'date'));
     if (empty($this->_service_date)) {
         add_message("No date supplied");
         return;
     }
     if (!in_array(array_get($_REQUEST, 'action'), array('populate', 'expand'))) {
         add_message("Invalid action specified");
         return;
     }
     $this->_action = $_REQUEST['action'];
     if (empty($_REQUEST['filename'])) {
         add_message("no filename supplied");
         return;
     }
     $this->_filename = self::resolveFilename($this->_action, $_REQUEST['filename']);
     if (!$this->_filename) {
         add_message("Unkown template " . $_REQUEST['filename']);
         return;
     }
     if (!empty($_REQUEST['replacements'])) {
         $method = '_process' . ucfirst($this->_action) . '';
         $this->{$method}();
     } else {
         $this->loadReplacements();
     }
 }
开发者ID:vanoudt,项目名称:jethro-pmm,代码行数:32,代码来源:view_0_generate_service_documents.class.php


示例14: processView

 function processView()
 {
     if (empty($_REQUEST['params_submitted']) && empty($_REQUEST['attendances_submitted'])) {
         if (!empty($_SESSION['attendance'])) {
             $this->_age_bracket = array_get($_SESSION['attendance'], 'age_bracket');
             $this->_congregationids = array_get($_SESSION['attendance'], 'congregationids');
             $this->_groupid = array_get($_SESSION['attendance'], 'groupid');
             $this->_show_photos = array_get($_SESSION['attendance'], 'show_photos', FALSE);
         }
         // Default to last Sunday, unless today is Sunday
         $this->_attendance_date = date('Y-m-d', date('D') == 'Sun' ? time() : strtotime('last Sunday'));
     }
     if (!empty($_REQUEST['params_submitted']) || !empty($_REQUEST['attendances_submitted'])) {
         $this->_attendance_date = process_widget('attendance_date', array('type' => 'date'));
         $this->_age_bracket = $_SESSION['attendance']['age_bracket'] = array_get($_REQUEST, 'age_bracket');
         $this->_show_photos = $_SESSION['attendance']['show_photos'] = array_get($_REQUEST, 'show_photos', FALSE);
         $status = NULL;
         // TODO
         if ($_REQUEST['for_type'] == 'congregationid') {
             $cids = process_widget('congregationid', array('type' => 'reference', 'references' => 'congregation', 'multiple' => true));
             foreach ($cids as $cid) {
                 if ($cid && !in_array($cid, $this->_congregationids)) {
                     $this->_congregationids[] = $cid;
                     $this->_record_sets[] = new Attendance_Record_Set($this->_attendance_date, $this->_age_bracket, $status, $cid, 0);
                 }
             }
             $_SESSION['attendance']['congregationids'] = $this->_congregationids;
             $_SESSION['attendance']['groupid'] = null;
         } else {
             $this->_groupid = process_widget('groupid', array('type' => 'reference', 'references' => 'person_group', 'allow_empty' => false));
             if ($this->_groupid) {
                 $this->_record_sets[] = new Attendance_Record_Set($this->_attendance_date, $this->_age_bracket, $status, NULL, $this->_groupid);
                 $_SESSION['attendance']['congregationids'] = array();
                 $_SESSION['attendance']['groupid'] = $this->_groupid;
             }
         }
         if ($this->_show_photos) {
             foreach ($this->_record_sets as $set) {
                 $set->show_photos = TRUE;
             }
         }
     }
     if (!empty($_REQUEST['attendances_submitted'])) {
         // Process step 2
         if ($_SESSION['enter_attendance_token'] == $_REQUEST['enter_attendance_token']) {
             // Clear the token from the session on disk
             $_SESSION['enter_attendance_token'] = NULL;
             session_write_close();
             session_start();
             // Process the form
             foreach ($this->_record_sets as $i => $set) {
                 if ($set->processForm($i)) {
                     $set->save();
                     if ((int) $set->congregationid) {
                         Headcount::save('congregation', $this->_attendance_date, $set->congregationid, $_REQUEST['headcount']['congregation'][$set->congregationid]);
                     } else {
                         Headcount::save('person_group', $this->_attendance_date, $set->groupid, $_REQUEST['headcount']['group'][$set->groupid]);
                     }
                 }
             }
         } else {
             trigger_error('Could not save attendances - synchronizer token does not match.  This probably means the request was duplicated somewhere along the line.  If you see your changes below, they have been saved by the other request');
             sleep(3);
             // Give the other one time to finish before we load again
             // Pretend we are back in step 2
             $_POST['attendances_submitted'] = FALSE;
             $_SESSION['enter_attendance_token'] = md5(time());
         }
     }
 }
开发者ID:samrae,项目名称:jethro-pmm,代码行数:70,代码来源:view_6_attendance__1_record.class.php


示例15: processView

 function processView()
 {
     if (empty($_POST['personid'])) {
         trigger_error("Cannot update persons, no person ID specified", E_USER_WARNING);
         return;
     }
     foreach ($this->_allowedFields as $field) {
         if (array_get($_POST, $field, '') == '') {
             unset($_POST[$field]);
         }
     }
     if (empty($_POST['date_typeid']) && count(array_intersect(array_keys($_POST), $this->_allowedFields)) == 0) {
         add_message("Cannot update; no new values were specified", 'error');
         if (!empty($_REQUEST['backto'])) {
             parse_str($_REQUEST['backto'], $back);
             unset($back['backto']);
             redirect($back['view'], $back);
         }
         return;
     }
     if (!is_array($_POST['personid'])) {
         $_REQUEST['personid'] = array($_REQUEST['personid']);
     }
     $GLOBALS['system']->includeDBClass('person');
     $success = 0;
     $GLOBALS['system']->setFriendlyErrors(TRUE);
     foreach ($_REQUEST['personid'] as $personid) {
         $this->_person = new Person((int) $personid);
         foreach ($this->_allowedFields as $field) {
             if (isset($_POST[$field])) {
                 $this->_person->setValue($field, $_POST[$field]);
             }
         }
         if (!empty($_POST['date_typeid'])) {
             $params = Person::getDateSubfieldParams();
             $dateval = process_widget('date_val', $params['date']);
             if (!$dateval) {
                 trigger_error("Invalid date value; cannot set date field");
                 return;
             }
             $this->_person->addDate($dateval, $_POST['date_typeid'], $_POST['date_note']);
         }
         if ($this->_person->validateFields() && $this->_person->save()) {
             $success++;
         }
     }
     if ($success == count($_REQUEST['personid'])) {
         add_message('Fields updated for ' . count($_REQUEST['personid']) . ' persons');
     } else {
         if ($success > 0) {
             add_message("Fields updated for {$success} persons; some persons could not be updated");
         } else {
             add_message('There was a problem updating the fields. Check your selected persons.');
         }
     }
     if (!empty($_REQUEST['backto'])) {
         parse_str($_REQUEST['backto'], $back);
         unset($back['backto']);
         redirect($back['view'], $back);
     }
 }
开发者ID:samrae,项目名称:jethro-pmm,代码行数:61,代码来源:view_0_persons_bulk_update.class.php


示例16: processWidget

 /**
  * Process an interface where an end user supplies a value for this custom field for a person record
  * @return mixed
  */
 public function processWidget()
 {
     $res = process_widget('custom_' . $this->id, $this->getWidgetParams());
     if ($this->getValue('type') == 'date' && !empty($this->values['params']['allow_note'])) {
         $notes = process_widget('custom_' . $this->id . '_note', array('type' => 'text'));
         foreach ((array) $notes as $k => $v) {
             if (!empty($res[$k])) {
                 $res[$k] .= ' ' . $v;
             }
         }
     }
     return $res;
 }
开发者ID:howardgrigg,项目名称:jethro-pmm,代码行数:17,代码来源:custom_field.class.php


示例17: processView


//.........这里部分代码省略.........
         }
         if (!empty($_POST['newfolder'])) {
             if ($newname = $this->_validateDirName($_POST['newfolder'])) {
                 $newdir = $this->_realdir . '/' . $newname;
                 if (is_dir($newdir) || mkdir($newdir)) {
                     if ($p = fileperms(DOCUMENTS_ROOT_PATH)) {
                         chmod($newdir, $p);
                     }
                     $this->_addMessage('Folder "' . $newname . '" created');
                     $this->_realdir = $newdir;
                 }
             }
         }
         if (!empty($_FILES['newfile'])) {
             foreach ($_FILES['newfile']['error'] as $key => $error) {
                 if ($error == UPLOAD_ERR_OK) {
                     $tmp_name = $_FILES["newfile"]["tmp_name"][$key];
                     if ($name = $this->_validateFileName($_FILES["newfile"]["name"][$key])) {
                         if (move_uploaded_file($tmp_name, $this->_realdir . '/' . $name)) {
                             if ($p = fileperms(DOCUMENTS_ROOT_PATH)) {
                                 chmod($this->_realdir . '/' . $name, $p);
                             }
                             $this->_addMessage('File "' . $name . '" saved');
                         }
                     }
                 } else {
                     trigger_error("There was an error ({$error}) uploading a file");
                 }
             }
         }
         if (!empty($_FILES['replacefile'])) {
             foreach ($_FILES['replacefile']['error'] as $origname => $error) {
                 if ($error == UPLOAD_ERR_OK && ($origname = $this->_validateFileName($origname))) {
                     $tmp_name = $_FILES["replacefile"]["tmp_name"][$origname];
                     if (file_exists($this->_realdir . '/' . $origname)) {
                         if (move_uploaded_file($tmp_name, $this->_realdir . '/' . $origname)) {
                             if ($p = fileperms(DOCUMENTS_ROOT_PATH)) {
                                 chmod($this->_realdir . '/' . $origname, $p);
                             }
                             $this->_addMessage('File "' . $origname . '" replaced');
                         }
                     }
                 }
             }
         }
         if (!empty($_POST['deletefile'])) {
             foreach ($_POST['deletefile'] as $delname) {
                 if ($delname = $this->_validateFileName($delname)) {
                     if (file_exists($this->_realdir . '/' . $delname) && unlink($this->_realdir . '/' . $delname)) {
                         $this->_addMessage('File "' . $delname . '" deleted');
                     }
                 }
             }
         }
         if (!empty($_POST['renamefile'])) {
             foreach ($_POST['renamefile'] as $origname => $newname) {
                 if (($newname = $this->_validateFileName($newname)) && ($origname = $this->_validateFileName($origname))) {
                     if (file_exists($this->_realdir . '/' . $origname) && rename($this->_realdir . '/' . $origname, $this->_realdir . '/' . $newname)) {
                         $this->_addMessage("{$origname} renamed to {$newname}");
                     }
                 }
             }
         }
         if (!empty($_POST['movefile'])) {
             foreach ($_POST['movefile'] as $filename => $newdir) {
                 if (($filename = $this->_validateFileName($filename)) && ($fulldir = $this->_validateDirPath($newdir))) {
                     if (rename($this->_realdir . '/' . $filename, $fulldir . '/' . $filename)) {
                         $this->_addMessage("\"{$filename}\" moved to folder \"{$newdir}\"");
                     }
                 }
             }
         }
         if (!empty($_REQUEST['editfile'])) {
             if ($_REQUEST['editfile'] == '_new_') {
                 $this->_editfile = '_new_';
             } else {
                 $this->_editfile = $this->_validateFileName($_REQUEST['editfile']);
             }
         }
         if (!empty($_POST['savefile'])) {
             if ($filename = $this->_validateFileName($_POST['savefile'])) {
                 if (!$this->_isHTML($filename)) {
                     trigger_error($this->_getExtension($filename) . " - Only HTML files can be saved", E_USER_ERROR);
                     // exits
                 }
                 if (!empty($_POST['isnew']) && file_exists($this->_realdir . '/' . $filename)) {
                     trigger_error("{$filename} already exists in this folder.  Please choose another name.");
                     $this->_editfile = $filename;
                 } else {
                     if (file_put_contents($this->_realdir . '/' . $filename, process_widget('contents', array('type' => 'html')))) {
                         if ($p = fileperms(DOCUMENTS_ROOT_PATH)) {
                             chmod($this->_realdir . '/' . $filename, $p);
                         }
                         $this->_addMessage("\"{$filename}\" saved");
                     }
                 }
             }
         }
     }
 }
开发者ID:samrae,项目名称:jethro-pmm,代码行数:101,代码来源:view_9_documents.class.php


示例18: _handleProgramSave

 private function _handleProgramSave()
 {
     // Update and/or create services on existing dates
     $dummy = new Service();
     foreach ($this->_grouped_services as $date => $date_services) {
         foreach ($this->_congregations as $congid) {
             if (isset($date_services[$congid])) {
                 // update the existing service
                 $dummy->populate($date_services[$congid]['id'], $date_services[$congid]);
                 if ($dummy->acquireLock()) {
                     $this->_processServiceCell($congid, $date, $dummy);
                     $dummy->save();
                     $dummy->releaseLock();
                 } else {
                     trigger_error("Could not acquire lock on individual service for {$congid} on {$date} - didn't save");
                 }
             } else {
                 if (!empty($_POST['topic_title'][$congid][$date]) || !empty($_POST['format_title'][$congid][$date]) || !empty($_POST['bible_ref0'][$congid][$date])) {
                     // create a new service
                     $service = new Service();
                     $service->setValue('date', $date);
                     $service->setValue('congregationid', $congid);
                     $this->_processServiceCell($congid, $date, $service);
                     $service->create();
                 }
             }
         }
     }
     // Add services on new dates
     $i = 0;
     while (isset($_POST['new_service_date_d'][$i])) {
         foreach ($this->_congregations as $congid) {
             if (!empty($_POST['topic_title'][$congid]['new_' . $i]) || !empty($_POST['format_title'][$congid]['new_' . $i]) || !empty($_POST['bible_refs'][$congid]['new_' . $i][0]) || !empty($_POST['bible_refs'][$congid]['new_' . $i][1])) {
                 // we need to create a service here
                 $service = new Service();
                 $service->setValue('date', process_widget('new_service_date[' . $i . ']', array('type' => 'date')));
                 $service->setValue('congregationid', $congid);
                 $this->_processServiceCell($congid, 'new_' . $i, $service);
                 $service->create();
             }
         }
         $i++;
     }
     $shifted = FALSE;
     // Process the "delete" commands if necessary
     if (!empty($_POST['delete_single'])) {
         $service = $GLOBALS['system']->getDBOBject('service', (int) $_POST['delete_single']);
         if ($service) {
             $service->delete();
             if (!empty($_POST['shift_after_delete'])) {
                 Service::shiftServices(array($service->getValue('congregationid')), $service->getValue('date'), '-7');
                 $shifted = TRUE;
             }
         }
     }
     if (!empty($_POST['delete_all_date'])) {
         $services = $GLOBALS['system']->getDBObjectData('service', array('date' => $_POST['delete_all_date'], 'congregationid' => $this->_congregations), 'AND');
         $dummy = new Service();
         foreach ($services as $id => $details) {
             $dummy->populate($id, $details);
             $dummy->delete();
             $shifted = TRUE;
         }
         if (!empty($_POST['shift_after_delete'])) {
             Service::shiftServices($this->_congregations, $_POST['delete_all_date'], '-7');
             $shifted = TRUE;
         }
     }
     // Process the "insert" commands if necessary
     if (!empty($_POST['insert_all_date'])) {
         Service::shiftServices($this->_congregations, $_POST['insert_all_date'], '7');
         $shifted = TRUE;
     }
     if (!empty($_POST['insert_single_date'])) {
         foreach ($_POST['insert_single_date'] as $congid => $date) {
             Service::shiftServices(array($congid), $date, '7');
             $shifted = TRUE;
         }
     }
     if (!$shifted) {
         foreach ($this->_congregations as $id) {
             $cong = $GLOBALS['system']->getDBObject('congregation', $id);
             $cong->releaseLock('services');
         }
         add_message("Services saved");
         redirect($_REQUEST['view'], array('editing' => NULL));
     }
     $this->_loadServices();
 }
开发者ID:samrae,项目名称:jethro-pmm,代码行数:89,代码来源:view_8_services__1_service_program.class.php


示例19: processWidget

 /**
  * Process an interface where an end user supplies a value for this custom field for a person record
  * @return mixed
  */
 public function processWidget()
 {
     $res = process_widget('custom_' . $this->id, $this->getWidgetParams(), NULL, TRUE);
     if ($this->getValue('type') == 'date' && !empty($this->values['params']['allow_note'])) {
         $notes = process_widget('custom_' . $this->id . '_note', array('type' => 'text'), NULL, TRUE);
         foreach ((array) $notes as $k => $v) {
             if (!empty($res[$k]) && strlen($v)) {
                 $res[$k] .= ' ' . $v;
             }
         }
     }
     if (is_array($res)) {
         $res = array_remove_empties($res);
     }
     return $res;
 }
开发者ID:vanoudt,项目名称:jethro-pmm,代码行数:20,代码来源:custom_field.class.php


示例20: processView

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP procthread函数代码示例发布时间:2022-05-15
下一篇:
PHP process_url函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap