当前位置: 首页>>代码示例>>PHP>>正文


PHP Service::populate方法代码示例

本文整理汇总了PHP中Service::populate方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::populate方法的具体用法?PHP Service::populate怎么用?PHP Service::populate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Service的用法示例。


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

示例1: printView


//.........这里部分代码省略.........
										<input type="submit" value="Send" />
										<input type="button" onclick="$(this).parents('form').toggle(); $(this).parents('tr:first').removeClass('tblib-hover')" value="Cancel" />
										</div>
									</form>
									<?php 
                    }
                }
            }
            ?>
					</td>
				<?php 
            $last_congid = NULL;
            foreach ($this->_members as $id => $mdetail) {
                $td_class = '';
                if ($mdetail['congregationid'] != $last_congid) {
                    $td_class = 'thick-left-border';
                    $last_congid = $mdetail['congregationid'];
                }
                ?>
					<td class="<?php 
                echo $td_class;
                ?>
">
					<?php 
                if ($mdetail['role_id']) {
                    if ($editing && empty($mdetail['readonly'])) {
                        $currentval = array();
                        foreach (array_get($ddetail['assignments'], $mdetail['role_id'], array()) as $pid => $pdetails) {
                            $currentval[$pid] = $pdetails['name'];
                        }
                        if (empty($role_objects[$mdetail['role_id']])) {
                            $role_objects[$mdetail['role_id']] =& $GLOBALS['system']->getDBObject('roster_role', $mdetail['role_id']);
                        }
                        if (empty($role_objects[$mdetail['role_id']])) {
                            // must've been a problem
                            continue;
                        }
                        $role_objects[$mdetail['role_id']]->printChooser($date, $currentval);
                    } else {
                        $names = array();
                        foreach (array_get($ddetail['assignments'], $mdetail['role_id'], array()) as $personid => $vs) {
                            if (!$public) {
                                $n = '<a href="' . BASE_URL . '?view=persons&personid=' . $personid . '" title="Assigned by ' . ents($vs['assigner']) . ' on ' . format_datetime($vs['assignedon']) . '">' . nbsp(ents($vs['name'])) . '</a>';
                                if (empty($vs['email'])) {
                                    $n .= '&nbsp;<img src="' . BASE_URL . 'resources/img/no_email.png" style="display:inline" title="No Email Address" />';
                                }
                                $names[] = $n;
                            } else {
                                $names[] = nbsp($vs['name']);
                            }
                        }
                        echo implode("<br />", $names);
                    }
                } else {
                    if (!empty($ddetail['service'][$mdetail['congregationid']])) {
                        if ($public && (!defined('SHOW_SERVICE_NOTES_PUBLICLY') || !SHOW_SERVICE_NOTES_PUBLICLY)) {
                            // no notes in public view
                            unset($ddetail['service'][$mdetail['congregationid']]['notes']);
                        }
                        $dummy_service->populate($ddetail['service'][$mdetail['congregationid']]['id'], $ddetail['service'][$mdetail['congregationid']]);
                        $dummy_service->printFieldvalue($mdetail['service_field']);
                    }
                }
                ?>
					</td>
					<?php 
            }
            if (!$public && count($this->_members) > REPEAT_DATE_THRESHOLD) {
                ?>
					<td class="nowrap thick-left-border">
						<strong><?php 
                echo str_replace(' ', '&nbsp;', date('j M y', strtotime($date)));
                ?>
</strong>
					</td>
					<?php 
            }
            ?>
				</tr>
				<?php 
        }
        ?>
		</tbody>

		<?php 
        if (!$public && count($to_print) > 6) {
            $this->_printTableFooter($editing, $public);
        }
        ?>

		</table>

		<?php 
        if ($editing) {
            ?>
			<input type="submit" class="btn" value="Save" accesskey="s" />
			</form>
			<?php 
        }
    }
开发者ID:howardgrigg,项目名称:jethro-pmm,代码行数:101,代码来源:roster_view.class.php

示例2: _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

示例3: printView


//.........这里部分代码省略.........
                }
            }
            ?>
					</td>
				<?php 
            $last_congid = NULL;
            foreach ($this->_members as $id => $mdetail) {
                $td_class = '';
                if ($mdetail['congregationid'] != $last_congid) {
                    $td_class = 'thick-left-border';
                    $last_congid = $mdetail['congregationid'];
                }
                ?>
					<td class="<?php 
                echo $td_class;
                ?>
">
					<?php 
                if ($mdetail['role_id']) {
                    $haveHidden = FALSE;
                    foreach (array_get($ddetail['assignments'], $mdetail['role_id'], array()) as $pid => $pdetails) {
                        if ($pdetails['assigneehidden']) {
                            $haveHidden = TRUE;
                        }
                    }
                    if ($editing && empty($mdetail['readonly']) && !$haveHidden) {
                        $currentval = array();
                        foreach (array_get($ddetail['assignments'], $mdetail['role_id'], array()) as $pid => $pdetails) {
                            $currentval[$pid] = $pdetails['name'];
                        }
                        if (empty($role_objects[$mdetail['role_id']])) {
                            $role_objects[$mdetail['role_id']] =& $GLOBALS['system']->getDBObject('roster_role', $mdetail['role_id']);
                        }
                        if (empty($role_objects[$mdetail['role_id']])) {
                            // must've been a problem
                            continue;
                        }
                        $role_objects[$mdetail['role_id']]->printChooser($date, $currentval);
                    } else {
                        $names = array();
                        foreach (array_get($ddetail['assignments'], $mdetail['role_id'], array()) as $personid => $vs) {
                            if (!$public && !$vs['assigneehidden']) {
                                $n = '<a href="' . BASE_URL . '?view=persons&personid=' . $personid . '" title="Assigned by ' . ents($vs['assigner']) . ' on ' . format_datetime($vs['assignedon']) . '">' . nbsp(ents($vs['name'])) . '</a>';
                                if ('' === $vs['email']) {
                                    $n .= '&nbsp;<img src="' . BASE_URL . 'resources/img/no_email.png" style="display:inline" title="No Email Address" />';
                                }
                                $names[] = $n;
                            } else {
                                $names[] = nbsp($vs['name']);
                            }
                        }
                        echo implode("<br />", $names);
                    }
                } else {
                    if (!empty($ddetail['service'][$mdetail['congregationid']])) {
                        if ($public && (!defined('SHOW_SERVICE_NOTES_PUBLICLY') || !SHOW_SERVICE_NOTES_PUBLICLY)) {
                            // no notes in public view
                            unset($ddetail['service'][$mdetail['congregationid']]['notes']);
                        }
                        $dummy_service->populate($ddetail['service'][$mdetail['congregationid']]['id'], $ddetail['service'][$mdetail['congregationid']]);
                        $dummy_service->printFieldvalue($mdetail['service_field']);
                    }
                }
                ?>
					</td>
					<?php 
            }
            if (!$public && count($this->_members) > REPEAT_DATE_THRESHOLD) {
                ?>
					<td class="nowrap thick-left-border">
						<strong><?php 
                echo str_replace(' ', '&nbsp;', date('j M y', strtotime($date)));
                ?>
</strong>
					</td>
					<?php 
            }
            ?>
				</tr>
				<?php 
        }
        ?>
		</tbody>

		<?php 
        if (!$public && count($to_print) > 6) {
            $this->_printTableFooter($editing, $public);
        }
        ?>

		</table>

		<?php 
        if ($editing) {
            ?>
			<input type="submit" class="btn" value="Save" accesskey="s" />
			</form>
			<?php 
        }
    }
开发者ID:vanoudt,项目名称:jethro-pmm,代码行数:101,代码来源:roster_view.class.php


注:本文中的Service::populate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。